Effective flow analysis for avoiding run-time checks
This paper describes a general purpose program analysis that computes global control-flow and data-flow information for higher-order, call-by-value programs. This information can be used to drive global program optimizations such as inlining and run-time check elimination, as well as optimizations like constant folding and loop invariant code motion that are typically based on special-purpose local analyses.
The analysis employs a novel approximation technique called polymorphic splitting that uses let-expressions as syntactic clues to gain precision. Polymorphic splitting borrows ideas from Hindley-Milner polymorphic type inference systems to create an analog to polymorphism for flow analysis.
Experimental results derived from an implementation of the analysis for Scheme indicate that the analysis is extremely precise and has reasonable cost. In particular, it eliminates significantly more run-time checks than simple flow analyses (i.e. 0CFA) or analyses based on type inference.
KeywordsFlow Analysis Type Inference Program Point Type Check Primitive Operation
Unable to display preview. Download preview PDF.
- 1.Alexander Aiken and Wimmers, Edward and T.K Lakshman. Soft Typing with Conditional Types. In 21th ACM Symposium on Principles of Programming Languages, pages 163–173, 1994.Google Scholar
- 2.Henk Barendregt. The Lambda Calculus. North-Holland, Amsterdam, 1981.Google Scholar
- 3.William Clinger and Jonathan Rees, editors. Revised4 Report on the Algorithmic Language Scheme. ACM Lisp Pointers, 4(3), July 1991.Google Scholar
- 4.Kent Dybvig. The Scheme Programming Language. Prentice-Hall, Inc., 1987.Google Scholar
- 5.Marc Feeley, Marc Turcotte, and Guy Lapalme. Using MultiLisp for Solving Constraint Satistfaction Problems: An Application to Nucleic Acid 3D Structure Determination. Lisp and Symbolic Computation, 7(2/3):231–248, 1994.Google Scholar
- 6.Leslie Greengard. The Rapid Evaluation of Potential Fields in Particle Systems. ACM Press, 1987.Google Scholar
- 7.Nevin Heintze. Set-Based Analysis of ML Programs. In Proceedings of the ACM Symposium on Lisp and Functional Programming, pages 306–317, 1994.Google Scholar
- 8.Fritz Henglein. Global Tagging Optimization by Type Inference. In Proceedings of the ACM Symposium on Lisp and Functional Programming, pages 205–215, 1992.Google Scholar
- 9.R. Hindley. The Principal Type-Scheme of an Object in Combinatory Logic. Transactions of the American Mathematical Society, 146:29–60, December 1969.Google Scholar
- 10.Suresh Jagannathan and Stephen Weeks. A Unified Treatment of Flow Analysis in Higher-Order Languages. In 22th ACM Symposium on Principles of Programming Languages, pages 392–401, January 1995.Google Scholar
- 11.Neil Jones and Stephen Muchnick. Flow Analysis and Optimization of Lisp-like Structures. In 6th ACM Symposium on Principles of Programming Languages, pages 244–256, January 1979.Google Scholar
- 12.Robin Milner. A Theory of Type Polymorphism in Programming. Journal of Computer and System Sciences, 17:348–375, 1978.Google Scholar
- 13.Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990.Google Scholar
- 14.John Mitchell. Handbook of Theoretical Computer Science: Volume B, chapter Type Systems for Programming Languages, pages 367–453. MIT Press, 1990.Google Scholar
- 15.Jens Palsberg. Global Program Analysis in Constraint Form. In Proceedings of the 1994 Colloquium on Trees in Algebra and Programming, pages 276–290. Springer-Verlag, 1994. Appears as LNCS 787.Google Scholar
- 16.Jens Palsberg and Patrick O'Keefe. A Type System Equivalent to Flow Analysis. In 22th ACM Symposium on Principles of Programming Languages, pages 367–378, January 1995.Google Scholar
- 17.Jens Palsberg and Michael Schwartzbach. Safety Analysis versus Type Inference. Information and Computation, to appear.Google Scholar
- 18.Gordon D. Plotkin. Call-by-name, call-by-value and the lambda-calculus. Theoretical Computer Science, 1:125–159, 1975.Google Scholar
- 19.Olin Shivers. Data-flow Analysis and Type Recovery in Scheme. In Topics in Advanced Language Implementation. MIT Press, 1990.Google Scholar
- 20.Olin Shivers. Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, School of Computer Science, Carnegie-Mellon University, 1991.Google Scholar
- 21.Peter Steenkiste and John Hennessy. Tags and type checking in lisp. In Proceedings of the Second Architectural Support for Programming Languages and Systems Symposium, pages 50–59, 1987.Google Scholar
- 22.Andrew Wright and Robert Cartwright. A Practical Soft Type System for Scheme. In Proceedings of the ACM Symposium on Lisp and Functional Programming, pages 250–262, 1994.Google Scholar
- 23.Feng Zhao. An O(N) Algorithm for Three-Dimensional N-Body Simulations. Master's thesis, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, 1987.Google Scholar