Abstract
Nonstrict higher order functional programming languages are notorious for their low run time efficiency. Optimizations based on flow analysis, which determines for each variable x in a program which expressions could have originated the value of x, can improve the situation by removing redundant eval and thunk operations, avoiding thunk updates, and allowing the use of unboxed representations of some data. We formulate flow analysis as an inference problem in a type system built using type inclusion constraints and an algorithm for solving these constraints is also given.
Work jointly funded by The Swedish Research Council for Engineering Sciences (TFR), grant 94-109, and Esprit BRA 8130 LOMAPS.
Preview
Unable to display preview. Download preview PDF.
References
Alexander Aiken, Edward L. Wimmers, and T. K. Lakshman. Soft typing with conditional types. In Conference Record of POPL '94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 163–173, Portland, Oregon, January 1994.
Lennart Augustsson. Compiling Lazy Functional Languages, Part II. PhD thesis, Chalmers University of Technology, 1987.
Urban Boquist. Interprocedural register allocation for lazy functional languages. In FPCA '95, San Diego, California, June 1995.
Luis Damas and Robin Milner. Principal type-schemes for functional programs. In Conference Record of the Ninth Annual ACM Symposium on Principles of Programming Languages, pages 207–212, 1982.
Benjamin Goldberg. Detecting sharing of partial applications in functional programs. In Proc. Functional Programming Lang. and Computer Arch., pages 408–425. Springer Verlag, 1987.
C. K. Gomard and P. Sestoft. Evaluation order analysis for lazy data structures. In Heldal, Holst, and Wadler, editors, Functional Programming, Glasgow Workshop 1991, pages 112–127. Springer-Verlag, 1991.
C. K. Gomard and P. Sestoft. Path analysis for lazy data structures. In M. Bruynooghe and M. Wirsing, editors, Programming Language Implementation and Logic Programming, 4th International Symposium, PLILP '92, Leuven, Belgium. (Lecture Notes in Computer Science, vol. 631), pages 54–68. Springer-Verlag, 1992.
Nevin Heintze. Set-based analysis of ML programs. In Proc. ACM Conference on LISP and Functional Programming, 1994.
Fritz Henglein and Jesper Jørgensen. Formally optimal boxing. In Conference Record of POPL '94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 213–226, Portland, Oregon, January 1994.
Hudak et al. Report on the programming language Haskell, a non-strict purely funcional language, version 1.2. Sigplan Notices, 27(5), May 1992.
John Hughes. Compile-time analysis of functional programs. In David Turner, editor, Research Topics in Functional Programming, chapter 5. Addison-Wesley, 1990.
John Hughes. Why functional programming matters. In David Turner, editor, Research Topics in Functional Programming. Addison-Wesley, 1990.
Thomas Johnsson. Analysing heap contents in a graph reduction intermediate language. In S.L. Peyton Jones, G. Hutton, and C.K. Holst, editors, Proceedings of the Glasgow Functional Programming Workshop, August 1991.
John Launchbury. A natural semantics for lazy evaluation. In Conference Record of the Twentieth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 144–154, Charleston, South Carolina, January 1993.
John Launchbury, Andrew Gill, John Hughes, Simon Marlow, Simon L Peyton Jones, and Philip Wadler. Avoiding unnecessary updates. In Proceedings of the fifth annual Glasgow Workshop on Functional Programming, July 1992.
Xavier Leroy. Polymorphism by name for references and continuations. In Conference Record of the Twentieth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 220–231, Charleston, South Carolina, January 1993.
Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348–375, December 1978.
A. Mycroft. Abstract interpretation and optimizing transformations for applicative programs. PhD thesis, Computer Science Dept,. Univ. of Edinburgh, 1981.
Jens Palsberg. Closure analysis in constraint form. In CAAP'94, 1994.
Simon L Peyton Jones and John Launchbury. Unboxed values as first class citizens in a non-strict functional language. In John Hughes, editor, FPCA '91, pages 636–666. Springer Verlag, 1991. LNCS 523.
Peter Sestoft. Analysis and efficient implementation of functional programs. PhD thesis, DIKU, University of Copenhagen, Denmark, October 1991.
Peter Sestoft. Deriving a lazy abstract machine. ID-TR 146, Dept. of Computer Science, Technical University of Denmark, September 1994.
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.
G.S. Smith. Principal type schemes for functional programs with overloading and subtyping. Science of Computer Programming, 23:197–226, December 1994.
Yan-Mei Tang and Pierre Jouvelot. Separate abstract interpretation for control-flow analysis. In TACS'94, 1994.
Mads Tofte and Jean-Pierre Talpin. Implementation of the typed call-by-value λ-calculus using a stack of regions. In Conference Record of POPL '94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 188–201, Portland, Oregon, January 1994.
Philip Wadler. Deforestration: Transforming programs to eliminate trees. In Harald Ganzinger, editor, ESOP '88, pages 344–358. Springer Verlag, 1989.
Mitchell Wand and Paul Steckler. Selective and lightweight closure conversion. In Conference Record of POPL '94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 435–445, Portland, Oregon, January 1994.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1995 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Faxén, K.F. (1995). Optimizing lazy functional programs using flow inference. In: Mycroft, A. (eds) Static Analysis. SAS 1995. Lecture Notes in Computer Science, vol 983. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60360-3_37
Download citation
DOI: https://doi.org/10.1007/3-540-60360-3_37
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-60360-3
Online ISBN: 978-3-540-45050-4
eBook Packages: Springer Book Archive