Skip to main content

Program analysis using mixed term and set constraints

  • Functional Programming I
  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((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.

Supported in part by NSF Young Investigator Award CCR-9457812 and NSF Grant CCR-9416973

This is a preview of subscription content, log in via an institution.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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. 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. 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. 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. 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. 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. 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. Cormac Flanagan and Matthias Felleisen. Componential set-based analysis. In PLDI'97 ]PLD97].

    Google Scholar 

  9. 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. 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. 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. N. Heintze. Set Based Program Analysis. PhD thesis, Carnegie Mellon University, 1992.

    Google Scholar 

  13. 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. 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. 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. Nevin Heintze and David McAllester. Linear-time subtransitive control flow analysis. In PLDI'97 [PLD97].

    Google Scholar 

  17. Proceedings of the International Conference on Functional Programming (ICFP '97), June 1997.

    Google Scholar 

  18. 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. 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. 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. David McAllester and Nevin Heintze. On the complexity of set-based analysis. In ICFP'97 [ICF97], pages 150–63.

    Google Scholar 

  22. R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348–375, 1978.

    Google Scholar 

  23. 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. 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. Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, Department of Computer Science, University of Copenhagen, 1996.

    Google Scholar 

  26. 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. Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990.

    Google Scholar 

  28. Simon Marlow and Philip Wadler. A practical subtyping system for Erlang. In ICFP'97 [ICF97].

    Google Scholar 

  29. Proceedings of the 1997 ACM SIGPLAN Conference on Programming Language Design and Implementation, June 1997.

    Google Scholar 

  30. 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. 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. 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. 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. 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. 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. 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 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Pascal Van Hentenryck

Rights and permissions

Reprints and permissions

Copyright information

© 1997 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Fähndrich, M., Aiken, A. (1997). Program analysis using mixed term and set constraints. In: Van Hentenryck, P. (eds) Static Analysis. SAS 1997. Lecture Notes in Computer Science, vol 1302. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0032737

Download citation

  • DOI: https://doi.org/10.1007/BFb0032737

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-63468-3

  • Online ISBN: 978-3-540-69576-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics