Abstract
In this paper, we present a method for optimizing the allocation of closures in memory. This method is based on escape analysis, an application of abstraction interpretation to higher order functional languages. Escape analysis determines, at compile time, if any arguments to a function have a greater lifetime than the function call itself. Such arguments, especially if they are closures, must be allocated in the heap rather than in the stack. In most implementations, however, stack allocation of closures is preferable due to the lower cost of allocation and reclamation. Therefore, we use escape analysis to determine when arguments can be stack allocated safely.
In the past, first order escape analysis has been used in optimizing LISP compilers, and has been described in various data-flow analysis frameworks for a language with complex types. The analysis described here, being higher order, provides more accurate escape information, although for a very simple higher order functional language.
This research was supported in part by a National Science Foundation Research Initiation Award, CCR-8909634
Chapter PDF
References
A. Appel and D.B. MacQueen. A standard ML compiler. In Proceedings of the 1987 Conference on Functional Programming and Computer Architecture. September, 1987.
J.M. Barth. Shifting garbage collection overhead to compile time. Communications of the ACM, 20(7), July 1977.
G.L. Burn, C.L. Hankin, and S. Abramsky. The theory of strictness analysis for higher order functions. In Programs as Data Objects, LNCS 217. Springer-Verlag. 1985
P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th Annual ACM Symposium on Principles of Programming Languages. January 1977.
D.R. Chase. Garbage Collection and Other Optimizations. Ph.D. Thesis, Rice University. 1987
D.R. Chase. Safety considerations for storage allocation optimizations. In Proceedings of the 1987 Conference on Functional Programming and Computer Architecture. September, 1987.
B. Goldberg. Detecting sharing of partial applications in functional programs. In Proceedings of the 1987 Conference on Functional Programming and Computer Architecture. September, 1987.
P. Hudak and J. Young. Higher-order strictness analysis for the untyped lambda calculus. In Proceedings of the 13th Annual ACM Symposium on Principles of Programming Languages. January, 1986.
N. Jones and S. Muchnick. Binding time optimization in programming languages: An approach to the design of an ideal language. In Proceedings of the 3rd Annual ACM Symposium on Principles of Programming Languages. January 1976.
D. Kranz. ORBIT: An Optimizing Compiler for Scheme. Ph.D. Thesis, Yale University, Department of Computer Science. May 1988.
S. Muchnick and N. Jones, editors. Flow Analysis and Optimization of LISP-like Structures. Prentice-Hall, 1981.
A. Mycroft. Abstract Interpretation and Optimizing Transformations for Applicative Programs. Ph.D. Thesis, University of Edinburgh. 1981.
C. Ruggieri and T.P. Murtagh. Lifetime analysis of dynamically allocated objects. Proceedings of the 15th Annual ACM Symposium on Principles of Programming Languages. January, 1988.
J.T. Schwartz. Optimization of very high level languages — I. Value transmission and its corollaries. Journal of Computer Languages, 1:161–194, 1975.
P. Wadler, Strictness analysis on non-flat domains. In Abstract Interpretation of Declarative Languages. C. L. Hankin and S. Abramsky, editors. Ellis Horwood, 1987.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1990 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Goldberg, B., Gil Park, Y. (1990). Higher order escape analysis: Optimizing stack allocation in functional program implementations. In: Jones, N. (eds) ESOP '90. ESOP 1990. Lecture Notes in Computer Science, vol 432. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-52592-0_61
Download citation
DOI: https://doi.org/10.1007/3-540-52592-0_61
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-52592-9
Online ISBN: 978-3-540-47045-8
eBook Packages: Springer Book Archive