CFA2: A Context-Free Approach to Control-Flow Analysis

  • Dimitrios Vardoulakis
  • Olin Shivers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6012)

Abstract

In a functional language, the dominant control-flow mechanism is function call and return. Most higher-order flow analyses, including k-CFA, do not handle call and return well: they remember only a bounded number of pending calls because they approximate programs with control-flow graphs. Call/return mismatch introduces precision-degrading spurious control-flow paths and increases the analysis time.

We describe CFA2, the first flow analysis with precise call/return matching in the presence of higher-order functions and tail calls. We formulate CFA2 as an abstract interpretation of programs in continuation passing style and describe a sound and complete summarization algorithm for our abstract semantics. A preliminary evaluation shows that CFA2 gives more accurate data-flow information than 0CFA and 1CFA.

References

  1. 1.
    Shivers, O.: Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University (1991)Google Scholar
  2. 2.
    Sharir, M., Pnueli, A.: Two Approaches to Interprocedural Data Flow Analysis. In: Program Flow Analysis, Theory and Application. Prentice Hall, Englewood Cliffs (1981)Google Scholar
  3. 3.
    Reps, T.W., Horwitz, S., Sagiv, S.: Precise Interprocedural Dataflow Analysis via Graph Reachability. In: Principles of Programming Languages, pp. 49–61 (1995)Google Scholar
  4. 4.
    Chaudhuri, S.: Subcubic Algorithms for Recursive State Machines. In: Principles of Programming Languages, pp. 159–169 (2008)Google Scholar
  5. 5.
    Alur, R., Benedikt, M., Etessami, K., Godefroid, P., Reps, T.W., Yannakakis, M.: Analysis of Recursive State Machines. Transactions on Programming Languages and Systems 27(4), 786–818 (2005)CrossRefGoogle Scholar
  6. 6.
    Schwoon, S.: Model-Checking Pushdown Systems. PhD thesis, Technische Universität München (2002)Google Scholar
  7. 7.
    Rehof, J., Fähndrich, M.: Type-Based Flow Analysis: From Polymorphic Subtyping to CFL-Reachability. In: Principles of Programming Languages, pp. 54–66 (2001)Google Scholar
  8. 8.
    Might, M., Shivers, O.: Improving Flow Analyses via ΓCFA: Abstract Garbage Collection and Counting. In: International Conference on Functional Programming, pp. 13–25 (2006)Google Scholar
  9. 9.
    Wright, A., Jagannathan, S.: Polymorphic Splitting: An Effective Polyvariant Flow Analysis. Trans. on Programming Languages and Systems 20(1), 166–207 (1998)CrossRefGoogle Scholar
  10. 10.
    Van Horn, D., Mairson, H.G.: Deciding k-CFA is complete for EXPTIME. In: International Conference on Functional Programming, pp. 275–282 (2008)Google Scholar
  11. 11.
    Clinger, W.D., Hansen, L.T.: Lambda, the Ultimate Label or a Simple Optimizing Compiler for Scheme. In: LISP and Functional Programming, pp. 128–139 (1994)Google Scholar
  12. 12.
    Might, M.: Environment Analysis of Higher-Order Languages. PhD thesis, Georgia Institute of Technology (2007)Google Scholar
  13. 13.
    Steele, G.L.: Rabbit: A Compiler for Scheme. Master’s thesis, MIT (1978)Google Scholar
  14. 14.
    Kranz, D.: ORBIT: An Optimizing Compiler for Scheme. PhD thesis, Yale University (1988)Google Scholar
  15. 15.
    Sabry, A., Felleisen, M.: Reasoning About Programs in Continuation-Passing Style. In: LISP and Functional Programming, pp. 288–298 (1992)Google Scholar
  16. 16.
    Shivers, O.: Higher-Order Control-Flow Analysis in Retrospect: Lessons Learned, Lessons Abandoned. In: Best of PLDI, pp. 257–269 (2004)Google Scholar
  17. 17.
    Vardoulakis, D., Shivers, O.: CFA2: a Context-Free Approach to Control-Flow Analysis. Technical Report NU-CCIS-10-01, Northeastern University (2010)Google Scholar
  18. 18.
    Yannakakis, M.: Graph-Theoretic Methods in Database Theory. In: Principles of Database Systems, pp. 230–242 (1990)Google Scholar
  19. 19.
    Melski, D., Reps, T.: Interconvertibility of a Class of Set Constraints and Context-Free-Language Reachability. Theoretical Comp. Sci. 248(1-2), 29–98 (2000)MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Heintze, N.: Set-based program analysis. PhD thesis, Carnegie-Mellon Univ. (1992)Google Scholar
  21. 21.
    Sridharan, M., Bodík, R.: Refinement-based context-sensitive points-to analysis for java. In: Programming Language Design and Implementation, pp. 387–400 (2006)Google Scholar
  22. 22.
    Hind, M.: Pointer analysis: haven’t we solved this problem yet? In: Program Analysis For Software Tools and Engineering, pp. 54–61 (2001)Google Scholar
  23. 23.
    Debray, S.K., Proebsting, T.A.: Interprocedural Control Flow Analysis of First-Order Programs with Tail-Call Optimization. Transactions on Programming Languages and Systems 19(4), 568–585 (1997)CrossRefGoogle Scholar
  24. 24.
    Midtgaard, J., Jensen, T.: Control-flow analysis of function calls and returns by abstract interpretation. In: International Conference on Functional Programming, pp. 287–298 (2009)Google Scholar
  25. 25.
    Kobayashi, N.: Types and higher-order recursion schemes for verification of higher-order programs. In: Principles of Programming Languages, pp. 416–428 (2009)Google Scholar
  26. 26.
    Agesen, O.: The Cartesian Product Algorithm: Simple and Precise Type Inference of Parametric Polymorphism. In: European Conference on Object-Oriented Programming, pp. 2–26 (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Dimitrios Vardoulakis
    • 1
  • Olin Shivers
    • 1
  1. 1.Northeastern University 

Personalised recommendations