Program analysis using mixed term and set constraints

  • Manuel Fähndrich
  • Alexander Aiken
Functional Programming I
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1302)

Abstract

There is a tension in program analysis between precision and efficiency. In constraint-based program analysis, at one extreme methods based on unification of equality constraints over terms are very fast but often imprecise. At the other extreme, methods based on the resolution of inclusion constraints over set expressions are quite precise, but are often inefficient in practice. We describe a parameterized framework for constraint-based program analyses that allows the analysis designer to embed terms and set expressions within each other. Constraints over these mixed expressions are partially between equality and inclusion, which enables an entire spectrum of program analyses with varying degrees of precision and efficiency to be expressed. We also show that there are interesting analyses that take advantage of this mixture. In particular, we report on the design and implementation of an uncaught exception analysis for core ML. Our results show that the analysis approaches the efficiency of algorithm W.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AKVW93]
    A. Aiken, D. Kozen, M. Vardi, and E. Wimmers. The complexity of set constraints. In E. Börger, Y. Gurevich, and K. Meinke, editors, Computer Science Logic '93, volume 832 of Lect. Notes in Comput. Sci., pages 1–17. Eur. Assoc. Comput. Sci. Logic, Springer, September 1993.Google Scholar
  2. [And94]
    L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994. DIKU report 94/19.Google Scholar
  3. [AW92]
    A. Aiken and E. Wimmers. Solving Systems of Set Constraints. In Symposium on Logic in Computer Science, pages 329–340, June 1992.Google Scholar
  4. [AW93]
    A. Aiken and E. Wimmers. Type Inclusion Constraints and Type Inference. In Proceedings of the 1993 Conference on Functional Programming Languages and Computer Architecture, pages 31–41, Copenhagen, Denmark, June 1993.Google Scholar
  5. [AWL94]
    A. Aiken, E. Wimmers, and T.K. Lakshman. Soft typing with conditional types. In Twenty-First Annual ACM Symposium on Principles of Programming Languages, pages 163–173, January 1994.Google Scholar
  6. [CC77]
    P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by contruction or approximation of fixed points. In Fourth Annual ACM Symposium on Principles of Programming Languages, pages 238–252, January 1977.Google Scholar
  7. [FA96]
    Manuel Fähndrich and Alex Aiken. Making set-constraint based program analyses scale. In First Workshop on Set Constraints at CP'96, Cambridge, MA, August 1996. Available as Technical Report CSDTR-96-917, University of California at Berkeley.Google Scholar
  8. [FF97]
    Cormac Flanagan and Matthias Felleisen. Componential set-based analysis. In PLDI'97 ]PLD97].Google Scholar
  9. [FFK+96]
    Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Stephanie Weirich, and Matthias Felleisen. Catching Bugs in the Web of Program Invariants. In Proceedings of the 1996 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 23–32, May 1996.Google Scholar
  10. [FM88]
    Y. Pub and P. Mishra. Type inference with subtypes. In Proceedings of the 1988 European Symposium on Programming, pages 94–114, 1988.Google Scholar
  11. [GS94]
    Juan Carlos Guzmán and Ascánder Suárez. An extended type system for exceptions. In Proceedings of the ACM SIGPLAN Workshop on ML and its Applications, pages 127–135, June 1994.Google Scholar
  12. [Hei92]
    N. Heintze. Set Based Program Analysis. PhD thesis, Carnegie Mellon University, 1992.Google Scholar
  13. [Hei94]
    Nevin Heintze. Set Based Analysis of ML Programs. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming, pages 306–17, June 1994.Google Scholar
  14. [Hen91]
    F. Henglein. Efficient Type Inference for Higher-Order Binding-Time Analysis. In 5th ACM Conference Proceedings on Functional Programming Languages and Computer Architecture, pages 448–72, 1991.Google Scholar
  15. [Hen92]
    F. Henglein. Global tagging optimization by type inference. In Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, pages 205–215, July 1992.Google Scholar
  16. [HM97]
    Nevin Heintze and David McAllester. Linear-time subtransitive control flow analysis. In PLDI'97 [PLD97].Google Scholar
  17. [ICF97]
    Proceedings of the International Conference on Functional Programming (ICFP '97), June 1997.Google Scholar
  18. [JG91]
    Pierre Jouvelot and David K. Gifford. Algebraic reconstruction of types and effects. In Proceedings of the 18th Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 303–310, January 1991.Google Scholar
  19. [LG88]
    John M. Lucassen and David K. Gifford. Polymorphic effect systems. In Proceedings of the 15th Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 47–57, 1988.Google Scholar
  20. [Luc87]
    John M. Lucassen. Types and Effects —Towards the Integration of Functional and Imperative Programming. Ph.D. thesis, MIT Laboratory for Computer Science, August 1987.Google Scholar
  21. [MH97]
    David McAllester and Nevin Heintze. On the complexity of set-based analysis. In ICFP'97 [ICF97], pages 150–63.Google Scholar
  22. [Mil78]
    R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348–375, 1978.Google Scholar
  23. [Mit84]
    J. Mitchell. Coercion and type inference (summary). In Eleventh Annual ACM Symposium on Principles of Programming Languages, pages 175–185, January 1984.Google Scholar
  24. [MNP97]
    Martin Müller, Joachim Niehren, and Andreas Podelski. Inclusion constraints over non-empty sets of trees. In Proceedings of the Seventh International Joint Conference on the Theory and Practice of Software Development (TAPSOFT'97), April 1997.Google Scholar
  25. [Mos96]
    Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, Department of Computer Science, University of Copenhagen, 1996.Google Scholar
  26. [MPS84]
    D. MacQueen, G. Plotkin, and R. Sethi. An ideal model for recursive polymophic types. In Eleventh Annual ACM Symposium on Principles of Programming Languages, pages 165–174, January 1984.Google Scholar
  27. [MTH90]
    Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990.Google Scholar
  28. [MW97]
    Simon Marlow and Philip Wadler. A practical subtyping system for Erlang. In ICFP'97 [ICF97].Google Scholar
  29. [PLD97]
    Proceedings of the 1997 ACM SIGPLAN Conference on Programming Language Design and Implementation, June 1997.Google Scholar
  30. [Pot96]
    François Pottier. Simplifying subtyping constraints. In Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming (ICFP '96), pages 122–133, January 1996.Google Scholar
  31. [SH97]
    Marc Shapiro and Susan Horwitz. Fast and accurate flow-insensitive points-to analysis. In Proceedings of the 24th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 1–14, January 1997.Google Scholar
  32. [Shi88]
    O. Shivers. Control flow analysis in Scheme. In Proceedings of the ACM SIGPLAN '88 Conference on Programming Language Design and Implementation, pages 164–174, June 1988.Google Scholar
  33. [Ste96]
    Bjarne Steensgaard. Points-to analysis in almost linear time. In Proceedings of the 23rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 32–41, January 1996.Google Scholar
  34. [TS96]
    Valery Trifonov and Scott Smith. Subtyping Constrained Types. In Proceedings of the 3rd International Static Analysis Symposium, pages 349–365, September 1996.Google Scholar
  35. [TT94]
    M. Tofte and J. P. Talpin. Implementation of the typed call-by-value λ-calculus using a stack of regions. In Twenty-First Annual ACM Symposium on Principles of Programming Languages, pages 188–201, 1994.Google Scholar
  36. [Yi94]
    Kwangkeun Yi. Compile-time detection of uncaught exceptions for Standard ML programs. In Proceedings of the 1st International Static Analysis Symposium, volume 864 of Lecture Notes in Computer Science. Springer, 1994.Google Scholar

Copyright information

© Springer-Verlag 1997

Authors and Affiliations

  • Manuel Fähndrich
    • 1
  • Alexander Aiken
    • 1
  1. 1.EECS DepartmentUniversity of CaliforniaBerkeley

Personalised recommendations