Skip to main content

Type-directed flow analysis for typed intermediate languages

  • Functional Programming II
  • Conference paper
  • First Online:
Static Analysis (SAS 1997)

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

Included in the following conference series:

Abstract

Flow analysis is especially valuable for optimizing functional languages because control-flow information is not syntactically apparent in higher-order programs. Flow analyses typically operate on untyped languages. However, recent compilers for typed functional languages such as ML and Haskell use a typed intermediate language to expose data representations for optimization. This paper presents a polyvariant flow analysis framework for the predicative subset of system F, a common basis for typed intermediate languages. Analyses in this framework can take advantage of types to analyze programs more precisely. We study a specific analysis called S RT that uses types to control polyvariance. We prove that S RT respects types: whenever it assigns abstract value \(\hat \upsilon\)to a variable and the type system assigns type σ to the same variable, then \(\left[ {\hat \upsilon } \right] \subseteq \left[ \sigma \right]\), where [ · ] denotes a set of values. S RT does not terminate 1569 1655 V 3 for some programs. We present several variants of S RT that are better suited to practical use.

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. Aiken, A., and Wimmers, E. L. Type inclusion constraints and type inference. Proceedings of the International Conference on Functional Programming Languages and Computer Architecture (1993), 31–41.

    Google Scholar 

  2. Aiken, A., Wimmers, E. L., and Lakshman, T. K. Soft typing with conditional types. In Proc. ACM Symp. Principles of Programming Languages (Jan. 1993), pp. 163–173.

    Google Scholar 

  3. Bacon, D. F., and Sweeney, P. F. Fast static analyses of C++ virtual function calls. In OOPSLA (1996).

    Google Scholar 

  4. Banerjee, A. A modular, polyvariant, and type-based closure analysis. In Intl. Conf. Functional Programming (June 1997).

    Google Scholar 

  5. Chambers, C., and Ungar, D. Iterative type analysis and extended messagesplitting: Optimizing dynamically-typed object-oriented programs. Lisp and Symbolic Computation 4, 3 (1991).

    Google Scholar 

  6. Dimock, A., Muller, R., Turbak, F., and Wells, J. Strongly typed flow-directed representation transformations. In Proceedings of the International Conference on Functional Programming Languages (1997), pp. 11–24.

    Google Scholar 

  7. Flanagan, C., and Felleisen, M. Componential set-based analysis. In Proc. ACM Conf. Programming Language Design and Implementation (June 1997).

    Google Scholar 

  8. Girard, J.-Y. Une extension de l'interprétation de Gödel à l'analyse, et son application à l'élimination des coupures dans l'analyse et la théorie des types. In Proceedings of the 2nd Scandinavian Logic Symposium (1971), J. E. Fenstad, Ed., North-Holland, pp. 63–92.

    Google Scholar 

  9. Harper, R., and Mitchell, J. C. On the type structure of Standard ML. ACM Transactions on Programming Languages and Systems 15, 2 (Apr. 1993), 211–252.

    Google Scholar 

  10. Harper, R., and Morrisett, J. G. Compiling polymorphism using intensional type analysis. In Proc. ACM Symp. Principles of Programming Languages (Jan. 1995), ACM, pp. 130–141.

    Google Scholar 

  11. Heintze, N. Set-based analysis of ML programs. In Proc. ACM Symp. Lisp and Functional Programming (1994), pp. 306–317.

    Google Scholar 

  12. Heintze, N. Control-flow analysis and type systems. In Proc. Intl. Static Analysis Symposium (Sept. 1995), pp. 189–206. Also appears as CMU-CS-94-227.

    Google Scholar 

  13. Heintze, N., and McAllester, D. Linear-time subtransitive control flow analysis. In Proc. ACM Conf. Programming Language Design and Implementation (June 1997).

    Google Scholar 

  14. Henglein, F., and Mossin, C. Polymorphic binding-time analysis. In Proc. European Symp. Programming (Apr. 1994), D. Sannella, Ed., vol. 788 of Lecture Notes in Computer Science, pp. 287–301.

    Google Scholar 

  15. Jagannathan, S., and Weeks, S. T. A unified treatment of flow analysis in higher-order languages. In Proc. ACM Symp. Principles of Programming Languages (Jan. 1995), pp. 393–407.

    Google Scholar 

  16. Jagannathan, S., and Wright, A. K. Effective flow analysis for avoiding runtime checks. In Proc. Intl. Static Analysis Symposium (Sept. 1995), mycroft, Ed., no. 983 in Lecture Notes in Computer Science, Springer-Verlag, pp. 207–224.

    Google Scholar 

  17. Jagannathan, S., and Wright, A. K. Flow-directed inlining. In Proc. ACM Conf. Programming Language Design and Implementation (May 1996), pp. 193–205.

    Google Scholar 

  18. Nielson, F., and Nielson, H. R. Infinitary control flow analysis: a collecting semantics for closure analysis. In Proc. ACM Symp. Principles of Programming Languages (Jan. 1997), ACM, pp. 332–345.

    Google Scholar 

  19. Palsberg, J., and O'Keefe, P. A type system equivalent to flow analysis. In Proc. ACM Symp. Principles of Programming Languages (Jan. 1995), ACM, pp. 367–378.

    Google Scholar 

  20. Peyton Jones, S. L. Compiling Haskell by program transformation: a report from the trenches. In Proc. European Symp. Programming (Apr. 1996).

    Google Scholar 

  21. Plevyak, J., and Chien, A. A. Precise concrete type inference of object-oriented programs. In OOPSLA (1994).

    Google Scholar 

  22. Reynolds, J. C. Towards a theory of type structure. In Paris Colloquium on Programming (1974), no. 19 in Lecture Notes in Computer Science, Springer-Verlag, pp. 408–425.

    Google Scholar 

  23. Schmidt, D. Natural-semantics-based abstract interpretation (preliminary version). In Proc. Intl. Static Analysis Symposium (Sept. 1995), A. Mycroft, Ed., no. 983 in Lecture Notes in Computer Science, Springer-Verlag, pp. 1–18.

    Google Scholar 

  24. Sharir, M., and Pnueli, A. Two approaches to interprocedural dataflow analysis. In Program Flow Analysis: Theory and Applications, S. S. Muchnick and N. D. Jones, Eds. Prentice-Hall, 1981, pp. 189–235.

    Google Scholar 

  25. Shivers, O.Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, Carnegie Mellon University, Computer Science Department, 1991.

    Google Scholar 

  26. Tarditi, D., Morrisett, J. G., Cheng, P., Stone, C., Harper, R., and Lee, P. TIL: A type-directed optimizing compiler for ML. In Proc. ACM Conf. Programming Language Design and Implementation (May 1996).

    Google Scholar 

  27. Turner, D. N., Wadler, P., and Mossin, C. Once upon a type. In Proc. Conf. Functional Programming and Computer Architecture (June 1995). *** DIRECT SUPPORT *** A0008C44 00006

    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

Jagannathan, S., Weeks, S., Wright, A. (1997). Type-directed flow analysis for typed intermediate languages. In: Van Hentenryck, P. (eds) Static Analysis. SAS 1997. Lecture Notes in Computer Science, vol 1302. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0032745

Download citation

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

  • 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