Academia.eduAcademia.edu

Outline

Efficient compilation of lazy evaluation

2004, ACM SIGPLAN Notices

https://doi.org/10.1145/989393.989409

Abstract

This paper describes the principles underlying an efficient implementation of a lazy functional language, compiling to code for ordinary computers. It is based on combinator-like graph reduction: the user defined functions are used as rewrite rules in the graph. Each function is compiled into an instruction sequence for an abstract graph reduction machine, called the G-machine, the code reduces a function application graph to its value. The G-machine instructions are then translated into target code. Speed improvements by almost two orders of magnitude over previous lazy evaluators have been measured; we provide some performance figures.

References (27)

  1. L. Augustsson. FC manual. Technical Report Memo 13, Programming Methodology Group, Chalmers University of Technology, Göteborg, Sweden, 1982.
  2. L. Augustsson. A Compiler for Lazy ML. In Proceedings of the 1984 ACM Symposium on Lisp and Functional Programming, pages 218-227, Austin, Texas, 1984.
  3. L. Augustsson. Compiling Pattern Matching. In Proceedings 1985 Conference on Functional Programming Languages and Computer Architecture, pages 368-381, Nancy, France, 1985.
  4. L. Augustsson. Compiling Lazy Functional Languages, Part II. PhD thesis, Department of Computer Science, Chalmers University of Technology, Göteborg, Sweden, November 1987.
  5. L. Augustsson. HBC User's Manual. Programming Methodology Group, Department of Computer Sciences, Chalmers, S-412 96
  6. L. Augustsson and T. Johnsson. Parallel Graph Reduction with the n, G -machine. In Proceedings of the 1989 Conference on Functional Languages and Computer Architecture, pages 202-213, London, England, 1989.
  7. L. Augustsson and T. Johnsson. The Chalmers Lazy-ML Compiler. The Computer Journal, 32(2):127-141, 1989.
  8. Lennart Augustsson. Implementing Haskell Overloading. In Proc. 6th Int'l Conf. on Functional Programming Languages and Computer Architecture (FPCA'93), pages 65-73. ACM Press, June 1993.
  9. Urban Boquist. Interprocedural Register Allocation for Lazy Functional Languages. In Proceedings of the 1995 Conference on Functional Programming Languages and Computer Architecture, La Jolla, CA, USA, June 1995.
  10. Urban Boquist. Code Optimisation Techniques for Lazy Functional Languages. PhD thesis, Department of Computing Science, Chalmers University of Technology, S-412 96
  11. Göteborg, Sweden, 1999.
  12. Urban Boquist and Thomas Johnsson. The GRIN Project: A Highly Optimising Back End For Lazy Functional Languages. In Selected papers from the 8th International Workshop on Implementation of Functional Languages, Bad Godesberg, Germany, September 1996. Springer-Verlag, LNCS 1268.
  13. G. Burn, J. Robson, and S. Peyton Jones. The Spineless G-machine. In Proceedings of the 1988 ACM Symposium on Lisp and Functional Programming, Snowbird, Utah, 1988.
  14. J. Fairbairn and S. C. Wray. Code generation techniques for functional languages. In Proceedings of the 1986 ACM Symposium on Lisp and Functional Programming, Cambridge, Mass., 1986.
  15. J. Fairbairn and S. C. Wray. TIM: A simple, lazy abstract machine to execute supercombinators. In Proceedings of the 1987 Conference on Functional Programming Languages and Computer Architecture, Portland, Oregon, September 1987.
  16. R. J. M. Hughes. Super Combinators-A New Implementation Method for Applicative Languages. In Proceedings of the 1982 ACM Symposium on Lisp and Functional Programming, pages 1-10, Pittsburgh, 1982.
  17. R. J. M. Hughes. The Design and Implementation of Programming Languages. PhD thesis, Programming Research Group, Oxford University, July 1983.
  18. T. Johnsson. Code Generation for Lazy Evaluation. Technical Report Memo 22, Programming Methodology Group, Chalmers University of Technology, Göteborg, Sweden, 1981.
  19. T. Johnsson. Ef cient Compilation of Lazy Evaluation. In Proceedings of the SIGPLAN '84 Symposium on Compiler Construction, pages 58-69, Montreal, 1984.
  20. T. Johnsson. Lambda Lifting: Transforming Programs to Recursive Equations. In Proceedings 1985 Conference on Functional Programming Languages and Computer Architecture, Lecture Notes in Computer Science 201, Nancy, France, 1985. Springer Verlag.
  21. T. Johnsson. Code Generation from G-machine code. In Proceedings of the workshop on Graph Reduction, Lecture Notes in Computer Science 279, Santa Fe, September 1986. Springer Verlag.
  22. T. Johnsson. Compiling Lazy Functional Languages. PhD thesis, Department of Computer Sciences, Chalmers University of Technology, Göteborg, Sweden, February 1987.
  23. Mark P. Jones. The implementation of the Gofer functional programming system. Technical Report YALEU/DCS/RR-1030, Department of Computer Science, Yale University, New Haven, Connecticut, USA, May 1994, May 94.
  24. Simon L. Peyton Jones. Implementing lazy functional languages on stock hardware: the spineless tagless g-machine. Journal of Functional Programming, 2(2):127-202, July 1992.
  25. Niklas Röjemo. Highlights from nhc -a space-ef cient Haskell compiler. In Proc. 7th Int'l Conf. on Functional Programming Languages and Computer Architecture (FPCA'95). ACM Press, June 1995.
  26. S. S. Thackar, editor. Selected reprints on Data ow and Reduction Architectures. IEEE Computer Society Press, 1987.
  27. D. A. Turner. A New Implementation Technique for Applicative Languages. Software-Practice and Experience, 9:31-49, 1979.