Skip to main content

Polyvariance, polymorphism and flow analysis

  • Conference paper
  • First Online:
Analysis and Verification of Multiple-Agent Languages (LOMAPS 1996)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1192))

Abstract

Flow analysis is a potentially very useful analysis for higher order functional languages, but its practical application has been slow in coining, partially hindered by shortcomings of the current analysis techniques. Among these are the limited precision, long analysis times, incompatibility with separate compilation, inapplicability to untyped languages and sensitivity to program structure associated with various earlier formulations.

We address these shortcomings with an approach based on a novel type system integrating recursive types, subtyping with liberal union types, and system F style polymorphism, in a constraint based formulation. The type system is “soft” in the sense that it does not reject programs. It is also not decidable, but there is a broad spectrum of sound and terminating, though incomplete, algorithms whose precision can be characterized by restricting the substitutions used for instantiation of type schemes. We give an inference algorithm which simplifies constraints incrementally, rather than postponing all constraint solving until all of the constraints are generated. In this way we hope to avoid in practice the exponential growth in the size of constraint sets caused by repeated instantiation of unsimplified type schemes. Type schemes are also a suitable representation for communicationg the analysis result over module boundaries, making separate compilation feasible.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. V. Aho, R. Sethi, and J. D. Ullman. Compilers principles, techniques, and tools. Addison-Wesley, Reading, MA, 1986.

    Google Scholar 

  2. Karl-Filip Faxén. Optimizing lazy functional programs using flow inference. In Alan Mycroft, editor, Proceedings of the Second International Symposium on Static Analysis, pages 136–153, Glasgow, UK, September 1995. Springer-Verlag.

    Google Scholar 

  3. Nevin Heintze. Set-based analysis of ML programs. In Proc. ACM Conference on LISP and Functional Programming, 1994.

    Google Scholar 

  4. Suresh Jagannathan and Stephen Weeks. A unified treatment of flow analysis in higher-order languages. In Principles of Programming Languages, 1995.

    Google Scholar 

  5. Suresh Jagannathan and Andrew Wright. Effective flow analysis for avoiding run-time checks. Technical Report 95-3, NEC Research Institute, May 1995.

    Google Scholar 

  6. N. D. Jones and S. S. Muchnick. A flexible approach to interprocedural data flow analysis and programs with recursive data structures. In Conference Record of the 9th Annual ACM Symposium on Principles of Programming Languages, pages 66–74, Albuquerque, NM, January 1982.

    Google Scholar 

  7. Neil D. Jones and Steven S. Muchnick. Flow analysis and optimization of Lisp-like structures. In Conference Record of the 6th Annual ACM Symposium on Principles of Programming Languages, pages 244–256, January 1979.

    Google Scholar 

  8. Jens Palsberg. Closure analysis in constraint form. In CAAP'94, 1994.

    Google Scholar 

  9. Peter Sestoft. Analysis and efficient implementation of functional programs. PhD thesis, DIKU, University of Copenhagen, Denmark, October 1991.

    Google Scholar 

  10. O. Shivers. Control flow analysis in Scheme. In Proceedings of the ACM SIGPLAN '88 Conference on Programming Language Design and Implementation, volume 23, pages 164–174, Atlanta, GA, June 1988.

    Google Scholar 

  11. O. Shivers. The semantics of Scheme control-flow analysis. In Proceedings of the Symposium on Partial Evaluation and Semantics-Based Program Manipulation, volume 26, pages 190–198, New Haven, CN, June 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Mads Dam

Rights and permissions

Reprints and permissions

Copyright information

© 1997 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Faxén, KF. (1997). Polyvariance, polymorphism and flow analysis. In: Dam, M. (eds) Analysis and Verification of Multiple-Agent Languages. LOMAPS 1996. Lecture Notes in Computer Science, vol 1192. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-62503-8_12

Download citation

  • DOI: https://doi.org/10.1007/3-540-62503-8_12

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-62503-2

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

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics