|
ABSTRACT
Many modern compilers 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 (or results)”. Closure conversion, which decides where and how to represent closures at runtime, is a crucial step in compilation of functional languages. We have a new algorithm that exploits the use of compile-time control and data flow information to optimize closure representations. By extensive closure sharing and allocating as many closures in registers as possible, our new closure conversion algorithm reduces heap allocation by 36% and memory fetches for local/global variables by 43%; and improves the already-efficient code generated by the Standard ML of New Jersey compiler by about 17% on a DECstation 5000. Moreover, unlike most other approaches, our new closure allocation scheme satisfies the strong “safe for space complexity” rule, thus achieving good asymptotic space usage.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
|
| |
3
|
Andrew W. Appel and Trevor Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, Princeton, N J, 1988.
|
 |
4
|
A. W. Appel , T. Jim, Continuation-passing, closure-passing style, Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.293-302, January 11-13, 1989, Austin, Texas, United States
[doi> 10.1145/75277.75303]
|
| |
5
|
Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. In Martin Wirsing, editor, Third Int'I Syrup. on Prog. Lang. Implementation and Logic Programming, pages 1-13, New York, August 1991. Springer-Verlag.
|
| |
6
|
|
| |
7
|
Andrew W. Appel and Zhong Shao. An empirical and analytic study of stack vs. heap cost for languages with closures. Technical Report CS-TR-450-94, Princeton University, Department of Computer Science, Princeton, N J, March 1994.
|
| |
8
|
Lennart Augustsson. Garbage collection in the < v,g >- machine. Technical Report PMG memo 73, Dept. of Computer Sciences, Chalmers University of Technology, Goteborg, Sweden, December 1989.
|
| |
9
|
Henry G. Baker. The buried binding and stale binding problems of LISP 1.5. unpublished, undistributed paper, June 1976.
|
 |
10
|
|
 |
11
|
|
 |
12
|
|
 |
13
|
Will Clinger , Anne Hartheimer , Eric Ost, Implementation strategies for continuations, Proceedings of the 1988 ACM conference on LISP and functional programming, p.124-131, July 25-27, 1988, Snowbird, Utah, United States
[doi> 10.1145/62678.62692]
|
| |
14
|
|
 |
15
|
|
 |
16
|
Amer Diwan , David Tarditi , Eliot Moss, Memory subsystem performance of programs using copying garbage collection, Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.1-14, January 16-19, 1994, Portland, Oregon, United States
[doi> 10.1145/174675.174710]
|
| |
17
|
|
 |
18
|
|
 |
19
|
Guy Lewis Steele, Jr. , Gerald Jay Sussman, The dream of a lifetime: A lazy variable extent mechanism, Proceedings of the 1980 ACM conference on LISP and functional programming, p.163-172, August 25-27, 1980, Stanford University, California, United States
[doi> 10.1145/800087.802802]
|
 |
20
|
|
 |
21
|
|
| |
22
|
|
 |
23
|
|
 |
24
|
|
 |
25
|
David Kranz , Norman Adams , Richard Kelsey , Jonathan Rees , Paul Hudak , James Philbin, ORBIT: an optimizing compiler for scheme, ACM SIGPLAN Notices, v.21 n.7, p.219-233, July 1986
|
| |
26
|
|
| |
27
|
P. J. Landin. The mechanical evaluation of expressions. Computer Journal, 6(4):308-20, 1964.
|
 |
28
|
|
| |
29
|
|
| |
30
|
Guillermo Juan Rozas. Liar, an algoblike compiler for scheme. S.B. thesis, MIT Dept. of Computer Science and Electrical Engineering, June 1984.
|
 |
31
|
|
| |
32
|
|
| |
33
|
|
| |
34
|
Robert E. Tarjan. Testing flow graph reducibility. Journal of Compuier and System Science, 9(3):355-365, December 1974.
|
 |
35
|
|
| |
36
|
|
CITED BY 29
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yasuhiko Minamide , Greg Morrisett , Robert Harper, Typed closure conversion, Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.271-283, January 21-24, 1996, St. Petersburg Beach, Florida, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|