skip to main content
article
Open Access

A practical and flexible flow analysis for higher-order languages

Published:01 July 1998Publication History
Skip Abstract Section

Abstract

A flow analysis collects data-flow and control-flow information about programs. A compiler can use this information to enable optimizations. The analysis described in this article unifies and extends previous work on flow analysis for higher-order languages supporting assignment and control operators. The analysis is abstract interpretation based and is parameterized over two polyvariance operators and a projection operator. These operators are used to regulate the speed and accuracy of the analysis. An implementation of the analysis is incorporated into and used in a production Scheme compiler. The analysis can process any legal Scheme program without modification. Others have demonstrated that a 0CFA analysis can enables the optimizations, but a 0CFA analysis is O(n)3). An O(n) instantiation of our analysis successfully enables the optimization of closure representations and procedure calls. Experiments with the cheaper instantiation show that it is as effective as 0CFA for these optimizations.

References

  1. ASHLEY~ J. iV{. 1997. The effectiveness of flow analysis for inlining. In Proceedings of the 1997ACM SIGPLAN International Conference on Functional Programming. ACM, New York, 99-111. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. ASHLEY~ J. ~/{. AND CONSEL~ C. 1994. Fixpoint computation for polyvariant static analyses of higher-order applicative programs. ACM Trans. Program. Lang. Syst. 16, 5, 1431-1448. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. ASHLEY~ J. iV{. AND DYBVIG~ R. K. 1994. An efficient implementation of multiple return values in Scheme. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming. ACM, New York, 140-149. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. ASHLEY~ J. iV{. AND DYBVIG~ R. K. 1998. A practical and flexible flow analysis for higher-order languages (extended version). Tech. Rep. DL-1998-02, Univ. of Kansas Design Laboratory, Lawrence, Kan. May.Google ScholarGoogle Scholar
  5. AYERS~ A. E. 1993. Abstract analysis and optimization of Scheme. Ph.D. thesis, MIT, Cambridge, Mass. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. BONDORF, A. 1993. Similix Manual, System Version 5.0. DIKU, Univ. of Copenhagen, Denmark.Google ScholarGoogle Scholar
  7. BOSE, B. 1991. DDD--A transformation system for Digital Design Derivation. Tech. Rep. 331, Computer Science Dept., Indiana Univ., Bloomington, Ind. May.Google ScholarGoogle Scholar
  8. BOUCHER~ D. AND FEELEY~ M. 1996. Abstract compilation: A new implementation paradigm for static analysis. In Proceedings of the 1996 International Conference on Compiler Construction. ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. BOURDONCLE~ F. 1992. Abstract interpretation by dynamic partitioning. J. Funct. Program. 2, 4 (Oct.), 407-436.Google ScholarGoogle Scholar
  10. BOURDONCLE~ F. 1993. Efficient chaotic iteration strategies with widening. In Proceedings of the International Conference on Formal Methods in Programming and their Applications. Lecture Notes in Computer Science, vol. 735. Springer-Verlag, Berlin, 128-141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. BURGER~ R. G. 1994. The Scheme machine. Tech. Rep. 413, Computer Science Dept., Indiana Univ., Bloomington, Ind. Aug.Google ScholarGoogle Scholar
  12. CONSEL~ C. 1993. Polyvariant binding-time analysis for higher-order, applicative languages. In Proceedings of the Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM '93. ACM, New York, 66-77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. COUSOT~ P. AND COUSOT~ R. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the gth A CM Symposium on Principles of Programming Languages. ACM, New York, 238-252. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. DYBVIG~ R. K. 1994. Chez Scheme System Manual, Rev. 2.4. Cadence Research Systems, Bloomington, Ind.Google ScholarGoogle Scholar
  15. DYBVIG~ R. K. AND HIEB~ R. 1990. A new approach to procedures with variable arity. Lisp Symbol. Comput. 3, 3 (Sept.}, 229-244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. FELLEISEN~ iV{. 1987. The calculi of lambda-v-cs-conversion: A syntactic theory of control and state in imperative higher-order programming languages. Ph.D. thesis, Indiana Univ., Bloomington, Ind. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. FLANAGAN~ C. AND FELLEISEN~ iV{. 1995. Set-based analysis for full Scheme and its use in softtyping. Tech. Rep. 253, Computer Science Dept., Rice Univ., Houston, Tex. Oct.Google ScholarGoogle Scholar
  18. FLANAGAN, C., SABRY, A., DUBA, B. F., AND FELLEISEN, M. 1993. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation. ACM, New York, 237-247. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. GABRIEL, R. P. 1985. Performance and Evaluation of LISP Systems. MIT Press Series in Computer Systems. MIT Press, Cambridge, Mass. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. HARRISON, W. L. 1989. The interprocedurM analysis and automatic parallelization of Scheme programs. Lisp Symbol. Comput. 2, 3/4, 179-396.Google ScholarGoogle Scholar
  21. HEINTZE, N. 1994. Set-based analysis of ML programs. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming. ACM, New York, 306-317. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. JAGANNATHAN, S. AND WEEKS, S. 1995. A unified treatment of flow analysis in higher-order languages. In Proceedings of the 22nd Annual A CM SIGPLAN//SIGA CT Symposium on Principles of Programming Languages. ACM, New York, 393-407. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. JONES, N. D., GOMARD, C. I~., AND SESTOFT, P. 1993. Partial Evaluation and Automatic Program Generation. Prentice-HM1, Englewood Cliffs, New Jersey. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. NIELSON, F. AND NIELSON, H. R. 1992. Two-Level Functional Languages. Cambridge Tracts in Theoretical Computer Science, vol. 34. Cambridge University Press, Cambridge, Mass. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. PALSBERG, J. AND SCHWARTZBACH, M. I. 1995. Safety analysis versus type inference. Inf. Comput. 118, 1, 128-141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. SERRANO, M. AND FEELEY, M. 1996. Storage use analysis and its applications. In Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming. ACM, New York, 50-61. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. SHAO, Z. AND APPEL, A. W. 1994. Space-efficient closure representations. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming. ACM, New York, 130-161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. SHIVERS, O. 1988. Control flow analysis in Scheme. In Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation. ACM, New York, 164-174. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. SHIVERS, O. 1991. Control-flow analysis of higher-order languages. Ph.D. thesis, Computer Science Dept., Carnegie Mellon Univ., Pittsburgh, Pa. Also available as Tech. Rep. CMU-CS-91-145. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. STECKLER, P. A. AND WAND, M. 1997. Lightweight closure conversion. ACM Trans. Program. Lang. Syst. 19, 1, 48-86. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. YI, K. AND HARRISON, W. L. 1993. Automatic generation and management of interprocedural program analyses. In Proceedings of the 20th Annual A CM SIGPLAN//SIGACT Symposium on Principles of Programming Languages. ACM, New York, 246-259. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. YOUNG, J. H. 1987. The theory and practice: Semantic program analysis for higher-order functional programming languages. Ph.D. thesis, Computer Science Dept., Yale Univ., New Haven, Conn. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A practical and flexible flow analysis for higher-order languages

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM Transactions on Programming Languages and Systems
      ACM Transactions on Programming Languages and Systems  Volume 20, Issue 4
      July 1998
      248 pages
      ISSN:0164-0925
      EISSN:1558-4593
      DOI:10.1145/291891
      Issue’s Table of Contents

      Copyright © 1998 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 July 1998
      Published in toplas Volume 20, Issue 4

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader