Dynamic slicing in higher-order programming languages

Dynamic slicing is a technique for isolating segments of a program that (potentially) contribute to the value computed at a point of interest. Dynamic slicing for restricted first-order imperative languages has been extensively studied in literature. In contrast, little research has been done with regard to the slicing of higher-order programs. Most first-order imperative programming languages are statement-based while most higher-order programming languages are expression-based. Unlike first-order programs, higher-order programs have no simple concept of static control flow: control flow depends on the binding of formal parameters to actuals. Because of these differences, formalising a definition of slicing for higher-order programs involves some novel concepts. The aim of the work, presented here, is to extract 'executable' slices of higher-order programs solely from the execution trace. In the absence of assignments, i.e. in purely functional programs, dynamic slices satisfying very strong criteria can be extracted. This is because purely functional languages have a demand-driven evaluation strategy. A realistic higher-order programming language, like Standard ML (SML), uses imperative features like assignments and exceptions. We provide algorithms to compute dynamic slices of programs containing such features. It is shown that, just like first-order programs, higher-order programs can be instrumented to collect data, regarding its dynamic slice, during execution. We have implemented a tool which performs such instrumentation on core SML programs. Experiments conducted, with the tool, throw light on the utility and limitations of dynamic slicing as technique for analysing higher-order programs.

[1]  Robin Milner,et al.  Co-Induction in Relational Semantics , 1991, Theor. Comput. Sci..

[2]  David W. Binkley,et al.  Interprocedural slicing using dependence graphs , 1990, TOPL.

[3]  Sandip K. Biswas A demand-driven set-based analysis , 1997, POPL '97.

[4]  Chris Hankin,et al.  Strictness Analysis for Higher-Order Functions , 1986, Sci. Comput. Program..

[5]  Susan Horwitz,et al.  Incremental program testing using program dependence graphs , 1993, POPL '93.

[6]  Frank Tip,et al.  A survey of program slicing techniques , 1994, J. Program. Lang..

[7]  Joseph Robert Horgan,et al.  Incremental regression testing , 1993, 1993 Conference on Software Maintenance.

[8]  Neil D. Jones,et al.  Flow analysis and optimization of LISP-like structures , 1979, POPL.

[9]  Nevin Heintze,et al.  Set-based analysis of ML programs , 1994, LFP '94.

[10]  Aleksy Schubert,et al.  The EML Kit Version 1 , 1996 .

[11]  B. Goldberg,et al.  Backward Analysis for Higher-Order Functions Using Inverse Images , 1992 .

[12]  I. V. Ramakrishnan,et al.  On the power and limitation of strictness analysis based on abstract interpretation , 1991, POPL '91.

[13]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[14]  Lennart Augustsson,et al.  A compiler for lazy ML , 1984, LFP '84.

[15]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[16]  Joseph Robert Horgan,et al.  Dynamic program slicing , 1990, PLDI '90.

[17]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[18]  Paul Hudak,et al.  Collecting interpretations of expressions , 1991, TOPL.

[19]  Carl A. Gunter Semantics of programming languages: structures and techniques , 1993, Choice Reviews Online.

[20]  FerranteJeanne,et al.  The program dependence graph and its use in optimization , 1987 .

[21]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.

[22]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[23]  Alan Mycroft,et al.  The Theory and Practice of Transforming Call-by-need into Call-by-value , 1980, Symposium on Programming.

[24]  Pascal Fradet,et al.  Collecting more garbage , 1994, LFP '94.

[25]  G Boudol Computational semantics of term rewriting systems , 1986 .

[26]  Frank Tip,et al.  Dynamic dependence in term rewriting systems and its application to program slicing , 1994, Inf. Softw. Technol..

[27]  G. A. Venkatesh,et al.  The semantic approach to program slicing , 1991, PLDI '91.

[28]  Dale Miller,et al.  From operational semantics to abstract machines , 1992, Mathematical Structures in Computer Science.

[29]  Matthias Felleisen,et al.  A call-by-need lambda calculus , 1995, POPL '95.

[30]  Nevin Charles Heintze,et al.  Set based program analysis , 1992 .

[31]  John Hughes,et al.  Lazy Memo-functions , 1985, FPCA.

[32]  Eugene H. Spafford,et al.  Debugging with dynamic slicing and backtracking , 1993, Softw. Pract. Exp..

[33]  Robin Milner,et al.  Commentary on standard ML , 1990 .

[34]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[35]  Matthias Felleisen,et al.  Abstract models of memory management , 1995, FPCA '95.

[36]  Wuu Yang,et al.  The Semantics of Program Slicing , 1988 .

[37]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[38]  Andrew W. Appel,et al.  A Debugger for Standard ML , 1995, Journal of Functional Programming.

[39]  Roy Levin,et al.  The Vesta Approach to Precise Configuration of Large Software Systems , 1993 .

[40]  Frank Tip,et al.  Parametric program slicing , 1995, POPL '95.

[41]  Colin RuncimanDepartment Lag, Drag, Void and Use { Heap Prooling and Space-eecient Compilation Revisited , 1996 .

[42]  John Hughes,et al.  Compile-time analysis of functional programs , 1990 .

[43]  John Field,et al.  On laziness and optimality in lambda interpreters: tools for specification and analysis , 1989, POPL '90.

[44]  John Launchbury,et al.  A natural semantics for lazy evaluation , 1993, POPL '93.

[45]  Robert S. Boyer,et al.  Computational Logic , 1990, ESPRIT Basic Research Series.

[46]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

[47]  Mark Weiser,et al.  Programmers use slices when debugging , 1982, CACM.

[48]  G. A. Venkatesh,et al.  Experimental results from dynamic slicing of C programs , 1995, TOPL.

[49]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[50]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[51]  N. Heintze Set Based Analysis of Arithmetic , 1993 .

[52]  Analysis and caching of dependencies , 1996, ICFP '96.

[53]  John Field,et al.  A Simple Rewriting Semantics for Realistic Imperative Programs and its Application to Program Analysis , 1992, ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation.

[54]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

[55]  Amitabha Sanyal,et al.  Labeled λ-calculus and a generalised notion of strictness , 1995 .

[56]  Mark David Weiser,et al.  Program slices: formal, psychological, and practical investigations of an automatic program abstraction method , 1979 .

[57]  Hareton K. N. Leung,et al.  Comments on Program Slicing , 1987, IEEE Trans. Software Eng..

[58]  Frits W. Vaandrager,et al.  Turning SOS Rules into Equations , 1994, Inf. Comput..

[59]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .