Efficient and safe-for-space closure conversion
- 1 January 2000
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Programming Languages and Systems
- Vol. 22 (1) , 129-161
- https://doi.org/10.1145/345099.345125
Abstract
Modern compilers often implement function calls (or returns) in two steps: first, a “closure” environment is properly installed to provide access for free variables in the target program fragment; second, the control is transferred to the target by a “jump with arguments (for results).” Closure conversion—which decides where and how to represent closures at runtime—is a crucial step in the compilation of functional languages. This paper presents a new algorithm that exploits the use of compile-time control and data-flow information to optimize funtion calls. By extensive closure sharing and allocation by 36% and memory fetches for local and global variables by 43%; and improves the already efficient code generated by an earlier version of the Standard ML of New Jersey compiler by about 17% on a DECstation 5000. Moreover, unlike most other approaches, our new closure-allocation scheme the strong safe-for-space-complexity rule, thus achieving good asymptotic space usage.Keywords
This publication has 19 references indexed in Scilit:
- A single intermediate language that supports multiple implementations of exceptionsACM SIGPLAN Notices, 2000
- Stack-based Typed Assembly LanguagePublished by Springer Nature ,1998
- Empirical and analytic study of stack versus heap cost for languages with closuresJournal of Functional Programming, 1996
- Loop headers in ?-calculus or CPSHigher-Order and Symbolic Computation, 1994
- Callee-save registers in continuation-passing styleHigher-Order and Symbolic Computation, 1992
- Garbage collection can be faster than stack allocationInformation Processing Letters, 1987
- Elimination algorithms for data flow analysisACM Computing Surveys, 1986
- The categorical abstract machinePublished by Springer Nature ,1985
- Testing flow graph reducibilityJournal of Computer and System Sciences, 1974
- The Mechanical Evaluation of ExpressionsThe Computer Journal, 1964