Advertisement

Optimizing lazy functional programs using flow inference

  • Karl -Filip Faxén
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 983)

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.

Keywords

Type Scheme Abstract Interpretation Functional Program Type Inference High Order Function 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    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.Google Scholar
  2. 2.
    Lennart Augustsson. Compiling Lazy Functional Languages, Part II. PhD thesis, Chalmers University of Technology, 1987.Google Scholar
  3. 3.
    Urban Boquist. Interprocedural register allocation for lazy functional languages. In FPCA '95, San Diego, California, June 1995.Google Scholar
  4. 4.
    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.Google Scholar
  5. 5.
    Benjamin Goldberg. Detecting sharing of partial applications in functional programs. In Proc. Functional Programming Lang. and Computer Arch., pages 408–425. Springer Verlag, 1987.Google Scholar
  6. 6.
    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.Google Scholar
  7. 7.
    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.Google Scholar
  8. 8.
    Nevin Heintze. Set-based analysis of ML programs. In Proc. ACM Conference on LISP and Functional Programming, 1994.Google Scholar
  9. 9.
    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.Google Scholar
  10. 10.
    Hudak et al. Report on the programming language Haskell, a non-strict purely funcional language, version 1.2. Sigplan Notices, 27(5), May 1992.Google Scholar
  11. 11.
    John Hughes. Compile-time analysis of functional programs. In David Turner, editor, Research Topics in Functional Programming, chapter 5. Addison-Wesley, 1990.Google Scholar
  12. 12.
    John Hughes. Why functional programming matters. In David Turner, editor, Research Topics in Functional Programming. Addison-Wesley, 1990.Google Scholar
  13. 13.
    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.Google Scholar
  14. 14.
    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.Google Scholar
  15. 15.
    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.Google Scholar
  16. 16.
    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.Google Scholar
  17. 17.
    Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348–375, December 1978.Google Scholar
  18. 18.
    A. Mycroft. Abstract interpretation and optimizing transformations for applicative programs. PhD thesis, Computer Science Dept,. Univ. of Edinburgh, 1981.Google Scholar
  19. 19.
    Jens Palsberg. Closure analysis in constraint form. In CAAP'94, 1994.Google Scholar
  20. 20.
    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.Google Scholar
  21. 21.
    Peter Sestoft. Analysis and efficient implementation of functional programs. PhD thesis, DIKU, University of Copenhagen, Denmark, October 1991.Google Scholar
  22. 22.
    Peter Sestoft. Deriving a lazy abstract machine. ID-TR 146, Dept. of Computer Science, Technical University of Denmark, September 1994.Google Scholar
  23. 23.
    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
  24. 24.
    G.S. Smith. Principal type schemes for functional programs with overloading and subtyping. Science of Computer Programming, 23:197–226, December 1994.Google Scholar
  25. 25.
    Yan-Mei Tang and Pierre Jouvelot. Separate abstract interpretation for control-flow analysis. In TACS'94, 1994.Google Scholar
  26. 26.
    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.Google Scholar
  27. 27.
    Philip Wadler. Deforestration: Transforming programs to eliminate trees. In Harald Ganzinger, editor, ESOP '88, pages 344–358. Springer Verlag, 1989.Google Scholar
  28. 28.
    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.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Karl -Filip Faxén
    • 1
  1. 1.Dept. of TeleinformaticsRoyal Institute of TechnologyKista

Personalised recommendations