Hostname: page-component-586b7cd67f-vdxz6 Total loading time: 0 Render date: 2024-11-21T02:40:48.782Z Has data issue: false hasContentIssue false

Tail recursion without space leaks

Published online by Cambridge University Press:  07 November 2008

Richard Jones
Affiliation:
Computing Laboratory, University of Kent at Canterbury, Canterbury, Kent CT2 7NF, UK (rej@ukc.ac.uk)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

The G-machine (Johnsson, 1987; Peyton Jones, 1987) is a compiled graph reduction machine for lazy functional languages. The G-machine compiler contains many optimizations to improve performance. One set of such optimizations is designed to improve the performance of tail recursive functions. Unfortunately, the abstract machine is subject to a space leak—objects are unnecessarily preserved by the garbage collector. This paper analyses why a particular form of space leak occurs in the G-machine, and presents some ideas for fixing this problem. This phenomena in other abstract machines is also examined briefly.

Type
Articles
Copyright
Copyright © Cambridge University Press 1992

References

Bauer, F. L. and Wössner, H. 1982. Algorithmic Language and Program Development. Springer-Verlag, Berlin.CrossRefGoogle Scholar
Burn, G. L., Peyton Jones, S. L. and Robson, J. D. 1988. The Spineless G-machine. In ACM Conference on Lisp and Functional Programming, pp. 244258, Snowbird (07), USA.Google Scholar
Fairbairn, J. and Wray, S. C. 1987. Tim—a simple lazy abstract machine to execute supercombinators. In IFIP Conference on Functional Programming and Computer Architecture, pp. 3445, Portland, USA (09).Google Scholar
Hughes, R. J. M. 1984. The design and implementation of programming languages, PhD thesis, PRG-40, University of Oxford, UK.Google Scholar
Johnsson, T. 1987. Compiling Lazy Functional Languages, PhD thesis, Chalmers University of Technology, Sweden.Google Scholar
Jones, Peyton S. L. 1987. The Implementation of Functional Programming Languages. Prentice-Hall, New York.Google Scholar
Jones, Peyton S. L. and Salkild, J. 1989. The Spineless Tagless G-machine. In IFIP Conference on Functional Programming and Computer Architecture, pp. 184201, London, UK (08).Google Scholar
Steele, G. L. and Sussman, G. J. 1977. Lambda—the ultimate goto. Tech. Report 443, AI Memo, MIT AI Laboratory.Google Scholar
Stoye, W. R., Clarke, T. J. W. and Norman, A. C. 1984. Some practical methods for rapid combinator reduction. In ACM Conference on Lisp and Functional Programming, Austin, USA.Google Scholar
Stoye, W. R. 1985. The implementation of functional languages using custom hardware. PhD Thesis, Computing Laboratory, University of Cambridge, Tech. Report 81 (12).Google Scholar
Turner, D. A. 1979. A new implementation technique for applicative languages. Software—Practice and Experience, 9: 3149.CrossRefGoogle Scholar
Wadler, P. 1987. Plumbers and dustmen: Fixing a space leak with a garbage collector. Software—Practice and Experience, 17: 595608.CrossRefGoogle Scholar
Wadsworth, C. P. 1971. The Semantics and Pragmatics of the Lambda Calculus. PhD thesis, University of Oxford, UK.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.