skip to main content
research-article
Free Access

Specialization Slicing

Published:01 June 2014Publication History
Skip Abstract Section

Abstract

This paper defines a new variant of program slicing, called specialization slicing, and presents an algorithm for the specialization-slicing problem that creates an optimal output slice. An algorithm for specialization slicing is polyvariant: for a given procedure р, the algorithm may create multiple specialized copies of р. In creating specialized procedures, the algorithm must decide for which patterns of formal parameters a given procedure should be specialized and which program elements should be included in each specialized procedure.

We formalize the specialization-slicing problem as a partitioning problem on the elements of the possibly infinite unrolled program. To manipulate possibly infinite sets of program elements, the algorithm makes use of automata-theoretic techniques originally developed in the model-checking community. The algorithm returns a finite answer that is optimal (with respect to a criterion defined in the article). In particular, (i) each element replicated by the specialization-slicing algorithm provides information about specialized patterns of program behavior that are intrinsic to the program, and (ii) the answer is of minimal size (i.e., among all possible answers with property (i), there is no smaller one).

The specialization-slicing algorithm provides a new way to create executable slices. Moreover, by combining specialization slicing with forward slicing, we obtain a method for removing unwanted features from a program. While it was previously known how to solve the feature-removal problem for single-procedure programs, it was not known how to solve it for programs with procedure calls.

References

  1. L. O. Andersen. 1993. Binding-time analysis and the taming of C pointers. In Part. Eval. and Semantics-Based Prog. Manip. 47--58. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. P. Anderson, T. Reps, and T. Teitelbaum. 2003. Design and implementation of a fine-grained software inspection tool. TSE 29, 8 (2003). Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. ANSI C. 2005. ISO/IEC 9899:TC2. (2005). “www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf”.Google ScholarGoogle Scholar
  4. S. Bates and S. Horwitz. 1993. Incremental program testing using program dependence graphs. In Conference Record of the Twentieth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1993), ACM Press, Charleston, SC, January 1993, 384--396. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Binkley. 1992. Using semantic differencing to reduce the cost of regression testing. In Proceedings of the IEEE International Conference on Software Maintenance (ICSM 1992), IEEE Computer Society, Orlando, FL, November 1992, 41--50.Google ScholarGoogle ScholarCross RefCross Ref
  6. D. Binkley. 1993. Precise executable interprocedural slices. LOPLAS 2 (1993), 31--45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. Binkley. 1997. Semantics guided regression test cost reduction. TSE 23, 8 (1997), 498--516. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Binkley. 2012. Personal Communication. (July 2012).Google ScholarGoogle Scholar
  9. D. Binkley, S. Danicic, T. Gyimóthy, M. Harman, Á. Kiss, and L. Ouarbya. 2004. Formalizing executable dynamic and forward slicing. In Proceedings of the 4th IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2004), IEEE Computer Society, Chicago, IL, September 2004, 43--52. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. D. Binkley, S. Danicic, M. Harman, J. Howroyd, and L. Ouarbya. 2006. A formal relationship between program slicing and partial evaluation. Formal Aspects of Computing 18, 2 (2006), 103--119. Google ScholarGoogle ScholarCross RefCross Ref
  11. D. Binkley and K. Gallagher. 1996. Program slicing. In Advances in Computers, Vol. 43. Marvin V. Zelkowitz (Ed.), 1--50. Academic Press.Google ScholarGoogle Scholar
  12. R. F. Book and F. Otto. 1993. String-Rewriting Systems. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Bouajjani, J. Esparza, A. Finkel, O. Maler, P. Rossmanith, B. Willems, and P. Wolper. 2000. An efficient automata approach to some problems on context-free grammars. IPL 74, 5--6 (2000), 221--227. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Bouajjani, J. Esparza, and O. Maler. 1997. Reachability analysis of pushdown automata: Application to model checking. In Proceedings of the 8th International Conference on Concurrency Theory (CONCUR 1997), Springer, Warsaw, Poland, July, 1997, 135--150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. R. Büchi. 1964. Regular canonical systems and finite automata. Arch. Math. Logik Grundlagenforschung 6 (1964), 91--111.Google ScholarGoogle ScholarCross RefCross Ref
  16. J. R. Büchi. 1988. Finite Automata, their Algebras and Grammars. Springer-Verlag. D. Siefkes (ed.).Google ScholarGoogle Scholar
  17. M. A. Bulyonkov. 1993. Extracting polyvariant binding time analysis from polyvariant specializer. In Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 1993), ACM Press, Copenhagen, Denmark, June 1993, 59--65. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. Canfora, A. Cimitile, A. De Lucia, and G. A. Di Lucca. 1994. Software salvaging based on conditions. In Proceedings of the International Conference on Software Maintenance (ICSM 1994), IEEE Computer Society, Victoria, BC, Canada, September 1994, 424--433. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Caucal. 1992. On the regular structure of prefix rewriting. Theor. Comp. Sci. 106, 1 (1992), 61--86. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. S. Chaudhuri. 2008. Subcubic algorithms for recursive state machines. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), ACM Press, San Francisco, CA, January 2008, 159--169. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. CodeSurfer. CodeSurfer System. (2014). Retrieved May 10, 2014 from www.grammatech.com/products/codesurfer.Google ScholarGoogle Scholar
  22. K. D. Cooper and K. Kennedy. 1988. Interprocedural side-effect analysis in linear time. PLDI. 57--66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Danicic, M. Daoudi, C. Fox, M. Harman, R. M. Hierons, J. Howroyd, L. Ouarbya, and M. P. Ward. 2005. ConSUS: A light-weight program conditioner. J. Syst. and Software 77, 3 (2005). Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. De Lucia, A. R. Fasolino, and M. Munro. 1996. Understanding function behaviors through program slicing. In Proceedings of the 4th International Workshop on Program Comprehension (WPC 1996), IEEE Computer Society, Berlin, Germany, March 1996, 9--10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. H. Do, S. G. Elbaum, and G. Rothermel. 2005. Supporting controlled experimentation with testing techniques: An infrastructure and its potential impact. Empirical Software Engineering 10, 4 (2005), 405--435. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. J. Esparza, D. Hansel, P. Rossmanith, and S. Schwoon. 2000. Efficient algorithms for model checking pushdown systems. In Proceedings of the 12th International Conference on Computer Aided Verification (CAV 2000), Springer, Chicago, IL, July 2000, 232--247. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. Field, G. Ramalingam, and F. Tip. 1995. Parametric program slicing. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Finkel, B. Willems, and P. Wolper. 1997. A direct symbolic approach to model checking pushdown systems. ENTCS 9 (1997).Google ScholarGoogle Scholar
  29. I. Forgács and T. Gyimóthy. 1997. An efficient interprocedural slicing method for large programs. In Proceedings of the 9th International Conference on Software Engineering & Knowledge Engineering (SEKE 1997), Madrid, Spain, June 1997.Google ScholarGoogle Scholar
  30. C. Fox, S. Danicic, M. Harman, and R. M. Hierons. 2004. ConSIT: A fully automated conditioned program slicer. SPE 34, 1 (2004). Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. K. B. Gallagher and J. R. Lyle. 1991. Using program slicing in software maintenance. TSE 17, 8 (Aug. 1991), 751--761. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. R. Giacobazzi and I. Mastroeni. 2003. Non-standard semantics for program slicing. HOSC 16, 4 (2003), 297--339. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. P. Godefroid, N. Klarlund, and K. Sen. 2005. DART: Directed automated random testing. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2005), ACM Press, Chicago, IL, June 2005, 213--223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. S. Graf and H. Saïdi. 1997. Construction of abstract state graphs with PVS. In Proceedings of the 9th International Conference on Computer Aided Verification (CAV 1997), Springer, Haifa, Israel, June 1997, 72--83. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. A. Gupta. 1994. Inductive Boolean Function Manipulation: A Hardware Verification Methodology for Automatic Induction. Ph.D. Dissertation. Carnegie Mellon Univ. Tech. Rep. CMU-CS-94-208.Google ScholarGoogle Scholar
  36. M. Harman, D. Binkley, and S. Danicic. 2003. Amorphous program slicing. J. Systems and Software 68, 1 (2003), 45--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. M. Harman and S. Danicic. 1997. Amorphous program slicing. In Proceedings of the 5th International Workshop on Program Comprehension (WPC 1997), IEEE Computer Society, Dearborn, MI, May 1997, 70--79. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. H. S. Hong, I. Lee, and O. Sokolsky. 2005. Abstract slicing: A new approach to program slicing based on abstract interpretation and model checking. In Proceedings of the 5th IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2005), IEEE Computer Society, Budapest, Hungary, September--October 2005, 25--34. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. J. E. Hopcroft. 1971. An n log n algorithm for minimizing the states in a finite automaton. In Proceedings of the International Symposium on the Theory of Machines and Computations, Haifa, Israel, Academic Press, New York, August 1971, 189--196.Google ScholarGoogle ScholarCross RefCross Ref
  40. S. Horwitz. 1990. Identifying the semantic and textual differences between two versions of a program. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 1990), ACM Press, White Plains, New York, NY, June 1990, 234--245. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. S. Horwitz, B. Liblit, and M. Polishchuck. 2010. Better debugging via output tracing and callstack-sensitive slicing. TSE 36, 1 (Jan. 2010). Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. S. Horwitz, J. Prins, and T. Reps. 1989. Integrating non-interfering versions of programs. TOPLAS 11, 3 (July 1989), 345--387. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. S. Horwitz and T. W. Reps. 1991. Efficient comparison of program slices. Acta Inf. 28, 8 (1991), 713--732. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. S. Horwitz and T. Reps. 1992. The use of program dependence graphs in software engineering. In Proceedings of the 14th International Conference on Software Engineering (ICSE 1992), ACM Press, Melbourne, Australia, May 1992, 392--411. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. S. Horwitz, T. Reps, and D. Binkley. 1990. Interprocedural slicing using dependence graphs. TOPLAS 12, 1 (Jan. 1990), 26--60. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. M. Hutchins, H. Foster, T. Goradia, and T. Ostrand. 1994. Experiments of the effectiveness of dataflow- and controlflow-based test adequacy criteria. Int. Conf. on Software Eng. 191--200. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. D. Jackson and E. J. Rollins. 1994. A new model of program dependences for reverse engineering. In Proceedings of the 2nd ACM SIGSOFT Symposium on Foundations of Software Engineering (SIGSOFT 1994), ACM Press, New Orleans, LA, December 1994, 2--10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. J. Jaffar, V. Murali, J. A. Navas, and A. E. Santosa. 2012. Path-sensitive backward slicing. In Proceedings of the 19th International Symposium on Static Analysis (SAS 2012), Springer, Deauville, France, September 2012, 231--247. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. N. D. Jones, C. K. Gomard, and P. Sestoft. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall International. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. N. Kidd, A. Lal, and T. Reps. 2007. WALi: The Weighted Automaton Library. (2007). www.cs.wisc.edu/wpis/wpds/download.php.Google ScholarGoogle Scholar
  51. J. Krinke. 2004. Context-sensitivity matters, but context does not. In Proceedings of the 4th IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2004), IEEE Computer Society, Chicago, IL, September 2004, 29--35. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. D. J. Kuck, R. H. Kuhn, B. Leasure, D. A. Padua, and M. Wolfe. 1981. Dependence graphs and compiler optimizations. In Conference Record of the 8th Annual ACM Symposium on Principles of Programming Languages (POPL 1981), ACM Press, Williamsburg, Virginia, January 1981, 207--218. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. A. Lakhotia and J. Deprez. 1998. Restructuring programs by tucking statements into functions. Inf. and Softw. Tech. 40, 11--12 (1998), 677--690.Google ScholarGoogle ScholarCross RefCross Ref
  54. J. Lyle and M. Weiser. 1986. Experiments on slicing-based debugging tools. In Proceedings of the 1st Workshop on Empirical Studies of Programmers, Ablex Pub. Corp., Washington, DC, June 1986, 187--197. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. J. R. Lyle and M. Weiser. 1987. Automatic program bug location by program slicing. In Proceedings of the 2nd International Conference on Computers and Applications, Peking, China, June 1987, 877--882.Google ScholarGoogle Scholar
  56. G. B. Mund and R. Mall. 2007. Program slicing. In The Compiler Design Handbook (2nd. ed.). Y. N. Srikant, Priti Shankar (Eds.), CRC Press, Chapter 14.Google ScholarGoogle Scholar
  57. OpenFST. 2012. OpenFst Library. (2012). www.openfst.org.Google ScholarGoogle Scholar
  58. K. J. Ottenstein and L. M. Ottenstein. 1984. The program dependence graph in a software development environment. In Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments (SDE 1984), ACM Press, Pittsburgh, PA, April 1984, 177--184. Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. L. Ouarbya, S. Danicic, M. Daoudi, M. Harman, and C. Fox. 2002. A denotational interprocedural program slicer. In Proceedings of the 9th Working Conference on Reverse Engineering (WCRE 2002), IEEE Computer Society, Richmond, VA, October--November 2002, 181--189. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. T. Reps. 1998. Program analysis via graph reachability. Inf. and Softw. Tech. 40, 11--12 (1998), 701--726.Google ScholarGoogle ScholarCross RefCross Ref
  61. T. Reps, S. Horwitz, M. Sagiv, and G. Rosay. 1994. Speeding up slicing. In Proceedings of the 2nd ACM SIGSOFT Symposium on Foundations of Software Engineering (FSE 1994), ACM Press, New Orleans, LA, December 1994, 11--20. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. T. Reps and G. Rosay. 1995. Precise interprocedural chopping. In Proceedings of the 3rd ACM SIGSOFT Symposium on Foundations of Software Engineering (FSE 1995), ACM Press, Washington, DC, October 1995, 41--52. Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. T. Reps and T. Turnidge. 1996. Program specialization via program slicing. In Selected Papers from the International Seminar on Partial Evaluation, Olivier Danvy, Robert Glück, Peter Thiemann (Eds.), Springer, Dagstuhl Castle, Germany, February 1996, 409--429. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. S. Schwoon. 2002. Model-Checking Pushdown Systems. Ph.D. Dissertation. Technical Univ. of Munich, Munich, Germany.Google ScholarGoogle Scholar
  65. J. Sebej. 2010. Reversal of regular languages and state complexity. In Proceedings of the Conference on Theory and Practice of Information Technologies (ITAT 2010), CEUR-WS.org, Vel'ka' Fatra, Slovak Republic, September 2010, 47--54.Google ScholarGoogle Scholar
  66. SIR. Software-artifact Infrastructure Repository. (2014). Retrieved May 10, 2014 from sir.unl.edu/portal/index.php.Google ScholarGoogle Scholar
  67. G. Snelting, T. Robschink, and J. Krinke. 2006. Efficient path conditions in dependence graphs for software safety analysis. TOSEM 15, 4 (2006), 410--457. Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. C. Sun, L. Tang, and Z. Chen. 2010. Enforcing reactive noninterference with reachability analysis. In Proceedings of the 10th International Conference on Quality Software (QSIC), IEEE Computer Society, Zhangjiajie, China, July 2010, 142--150.Google ScholarGoogle Scholar
  69. C. Sun, L. Tang, and Z. Chen. 2011. Enforcing reactive noninterference with reachability analysis. In Proceedings of the 8th International Conference on Information Technology: New Generations (ITNG), IEEE Computer Society, Las Vegas, NV, April 2011, 321--326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  70. F. Tip. 1995. A survey of program slicing techniques. JPL 3, 3 (1995).Google ScholarGoogle Scholar
  71. M. Weiser. 1984. Program slicing. TSE 10, 4 (July 1984), 352--357. Google ScholarGoogle ScholarDigital LibraryDigital Library
  72. Wikipedia: Output-Sensitive Algorithm 2014. Output-sensitive algorithm. (2014). en.wikipedia.org/wiki/Output-sensitive_algorithm, Jan. 5, 2014.Google ScholarGoogle Scholar
  73. M. Yannakakis. 1990. Graph-theoretic methods in database theory. In Proceedings of the 9th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS), ACM Press, Nashville, TN, 230--242. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Specialization Slicing

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!