Using Strictness in the STG Machine
To implement lazy evaluation, closures representing unevaluated expressions must be built in the heap and garbage collected and may need to be updated. Functions must include extra code to ensure that their needed arguments are evaluated. It is more efficient to pass arguments using call-by-value wherever this will give the same result as lazy evaluation.
We examine Spineless Tagless G-Machine code for different argument passing conventions: lazy, call-by-value and unboxed. We also consider the costs of updates and give performance results for some program fragments.
Unable to display preview. Download preview PDF.
- [Aug87]L. Augustsson. Compiling Lazy Functional Languages, Part II. PhD thesis, Chalmers Tekniska Högskola, Göteborg, Sweden, 1987.Google Scholar
- [Bur91]G.L. Burn. Lazy Functional Languages: Abstract Interpretation and Compilation. Research Monographs in Parallel and Distributed Computing. Pitman in association with MIT Press, 1991. 238pp.Google Scholar
- [BW88]R. Bird and P. Wadler. Introduction to Functional Programming. Prentice Hall, 1988.Google Scholar
- [FB93]S.O. Finne and G.L. Burn. Assessing the evaluation transformer model of reduction on the Spineless G-Machine. In Proceedings of the Conference on Functional Programming and Computer Architecture. ACM, June 1993.Google Scholar
- [Hal92]C.V. Hall. An optimist’s view of life: Transforming list expressions. Technical report, Department of Computer Science, University of Glasgow, 1992.Google Scholar
- [Har91]P.H. Hartel. On the benefits of different analyses in the compilation of lazy functional languages. In 3rd Informal International Workshop on the Parallel Implementation of Functional Languages, pages 123–145, Southampton, 1991.Google Scholar
- [Noc93]E. Nocker. Strictness analysis using abstract reduction. In Proceedings of the Conference on Functional Programming and Computer Architecture. ACM, June 1993.Google Scholar
- [Pey92]S.L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Technical Report 2, Department of Computing Science, University of Glasgow G12 8QQ., April 1992. FTP: ftp.dcs.glasgow.ac.uk in /pub/glasgow-fp/papers/spineless-tagless-gmachine.dvi.Google Scholar
- [PL91]S.L. Peyton Jones and J. Launchbury. Unboxed values as first class citizens in a non-strict functional language. In J. Hughes, editor, Proceedings of the Conference on Functional Programming and Computer Architecture, pages 636–666, Cambridge, Massachussets, USA, 26-28 August 1991. Springer-Verlag LNCS523.Google Scholar
- [PP93]S.L. Peyton Jones and W. Partain. Measuring the effectiveness of a simple strictness analyser. In J.T. O’Donnell, editor, Glasgow Workshop on Functional Programming 1993, Lecture Notes in Computer Science. Springer-Verlag, 5-7 July 1993.Google Scholar
- [SNvGP91]S. Smetsers, E. Nöcker, J. van Groningen, and R. Plasmeijer. Generating efficient code for lazy functional languages. In J. Hughes, editor, Proceedings of the Conference on Functional Programming and Computer Architecture, number 523 in Lecture Notes in Computer Science, pages 592–617, Cambridge, Massachussets, USA, 26-28 August 1991. Springer-Verlag.Google Scholar