Skip to main content
×
Home
    • Aa
    • Aa

Systematic abstraction of abstract machines

  • DAVID VAN HORN (a1) and MATTHEW MIGHT (a2)
Abstract
Abstract

We describe a derivational approach to abstract interpretation that yields novel and transparently sound static analyses when applied to well-established abstract machines for higher-order and imperative programming languages. To demonstrate the technique and support our claim, we transform the CEK machine of Felleisen and Friedman (Proc. of the 14th ACM SIGACT-SIGPLAN Symp. Prin. Program. Langs, 1987, pp. 314–325), a lazy variant of Krivine's machine (Higher-Order Symb. Comput. Vol 20, 2007, pp. 199–207), and the stack-inspecting CM machine of Clements and Felleisen (ACM Trans. Program. Lang. Syst. Vol 26, 2004, pp. 1029–1052) into abstract interpretations of themselves. The resulting analyses bound temporal ordering of program events; predict return-flow and stack-inspection behavior; and approximate the flow and evaluation of by-need parameters. For all of these machines, we find that a series of well-known concrete machine refactorings, plus a technique of store-allocated continuations, leads to machines that abstract into static analyses simply by bounding their stores. These machines are parameterized by allocation functions that tune performance and precision and substantially expand the space of analyses that this framework can represent. We demonstrate that the technique scales up uniformly to allow static analysis of realistic language features, including tail calls, conditionals, mutation, exceptions, first-class continuations, and even garbage collection. In order to close the gap between formalism and implementation, we provide translations of the mathematics as running Haskell code for the initial development of our method.

Copyright
Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

M. S. Ager , O. Danvy & J. Midtgaard (2004, June) A functional correspondence between call-by-need evaluators and lazy abstract machines. Inf. Process. Lett. 90 (5), 223232.

J. M. Ashley & R. K. Dybvig (1998) A practical and flexible flow analysis for higher-order languages. ACM Trans. Program. Lang. Syst. 20 (4), 845868.

M. Biernacka & O. Danvy (2007) A concrete framework for environment machines. ACM Trans. Comput. Logic 9 (1), 130.

A. Bouajjani , J. Esparza & O. Maler (1997) Reachability analysis of pushdown automata: Application to model-checking. In Proceedings of the 8th International Conference on Concurrency Theory (CONCUR '97) Warsaw, Poland, pp. 135150.

J. Clements & M. Felleisen (2004, November) A tail-recursive machine with stack inspection. ACM Trans. Program. Lang. Syst. 26 (6), 10291052.

P. Cousot & R. Cousot (1979) Systematic design of program analysis frameworks. In Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL '79), San Antonio, TX, USA, pp. 269282.

K. Faxén (1995) Optimizing lazy functional programs using flow inference. In Static Analysis, Lecture Notes in Computer Science, vol. 983, Springer, pp. 136153.

M. Felleisen & D. P. Friedman (1987) A calculus for assignments in higher-order languages. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages POPL '87, Munich, Germany, pp. 314325.

C. Flanagan , A. Sabry , B. F. Duba & M. Felleisen (1993, June) The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation (PLDI '93), Albuquerque, NM, USA, pp. 237247.

W. L. Harrison (1989, October) The interprocedural analysis and automatic parallelization of scheme programs. LISP Symb. Comput. 2 (3), 179396.

N. Jones & N. Andersen (2007, May) Flow analysis of lazy higher-order functional programs. Theor. Comput. Sci. 375 (1–3), 120136.

J. Kodumal & A. Aiken (2004, June) The set constraint/CFL reachability connection in practice. In Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation (PLDI '04), Washington, DC, USA, pp. 207218.

J.-L. Krivine (2007, September) A call-by-name lambda-calculus machine. Higher-Order Symb. Comput. 20 (3), 199207.

P. J. Landin (1964) The mechanical evaluation of expressions. Comput. J. 6 (4), 308320.

P. Meunier , R. B. Findler & M. Felleisen (2006, January) Modular set-based analysis from contracts. In Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '06), Charleston, SC, USA, pp. 218231.

J. Midtgaard (2012, June) Control-flow analysis of functional programs. ACM Comput. Surv. 44 (3), 10:1–10:33.

J. Midtgaard & T. P. Jensen (2009) Control-flow analysis of function calls and returns by abstract interpretation. In Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming (ICFP '09), Edinburgh, Scotland, pp. 287298.

M. Might & O. Shivers (2006) Improving flow analyses via Gamma-CFA: Abstract garbage collection and counting. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming (ICFP '06), Portland, OR, USA, pp. 1325.

G. Morrisett , M. Felleisen & R. Harper (1995) Abstract models of memory management. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA '95), La Jolla, CA, USA, pp. 6677.

F. Nielson , H. R. Nielson & C. Hankin (1999) Principles of Program Analysis. New York: Springer.

F. Pottier , C. Skalka & S. Smith (2005, March) A systematic approach to static access control. ACM Trans. Program. Lang. Syst. 27 (2), 344382.

T. Reps (1998, December) Program analysis via graph reachability. Inf. Softw. Technol. 40 (11–12), 701726.

J. C. Reynolds (1972) Definitional interpreters for higher-order programming languages. In Proceedings of the ACM Annual Conference (ACM 1972), New York, USA, pp. 717740.

Z. Shao & A. W. Appel (1994) Space-efficient closure representations. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming (LFP '94), New York, USA, pp. 150161.

C. Skalka & S. Smith (2000, September) Static enforcement of security with types. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP '00), Montreal, Canada, pp. 3445.

D. Van Horn & M. Might (2010) Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP '10), Baltimore, MD, USA, pp. 5162.

D. Van Horn & M. Might (2011, September) Abstracting abstract machines: A systematic approach to higher-order program analysis. Commun. ACM 54 (9), 101109.

D. Vardoulakis & O. Shivers (2011, May) CFA2: A context-free approach to control-flow analysis. Logical Methods Comput. Sci. 7 (2), 139.

A. K. Wright & S. Jagannathan (1998) Polymorphic splitting: An effective polyvariant flow analysis. ACM Trans. Program. Lang. Syst. 20 (1), 166207.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×