|
ABSTRACT
Lambda-lifting a functional program transforms it into a set of recursive equations. We present the symmetric transformation: lambda-dropping. Lambda-dropping a set of recursive equations restores block structure and lexical scope.For lack of scope, recursive equations must carry around all the parameters that any of their callees might possibly need. Both lambda-lifting and lambda-dropping thus require one to compute a transitive closure over the call graph:• for lambda-lifting: to establish the Def/Use path of each free variable (these free variables are then added as parameters to each of the functions in the call path);• for lambda-dropping: to establish the Def/Use path of each parameter (parameters whose use occurs in the same scope as their definition do not need to be passed along in the call path).Without free variables, a program is scope-insensitive. Its blocks are then free to float (for lambda-lifting) or to sink (for lambda-dropping) along the vertices of the scope tree.We believe lambda-lifting and lambda-dropping are interesting per se, both in principle and in practice, but our prime application is partial evaluation: except for Malmkjær and Ørbæk's case study presented at PEPM '95, most polyvariant specializers for procedural programs operate on recursive equations. To this end, in a pre-processing phase, they lambda-lift source programs into recursive equations, As a result, residual programs are also expressed as recursive equations, often with dozens of parameters, which most compilers do not handle efficiently. Lambda-dropping in a post-processing phase restores their block structure and lexical scope thereby significantly reducing both the compile time and the run time of residual programs.
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
|
Alfred V. Aho , Ravi Sethi , Jeffrey D. Ullman, Compilers: principles, techniques, and tools, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1986
|
| |
2
|
|
| |
3
|
Lennart Augustsson. Compiling Lazy Functional Languages, part II. PhD thesis, Department of Computer Sciences, Chalmers University of Technology, GSteborg, Sweden, 1988.
|
| |
4
|
|
| |
5
|
Henk Barendregt. The Lambda Calculus -- Its Syntax and Semantics. North-Holland, 1984.
|
| |
6
|
Lars Birkedal and Morten Welinder. Partial evaluation of Standard ML. Master's thesis, DIKU, Computer Science Department, University of Copenhagen, August 1993. DIKU Rapport 93/22.
|
 |
7
|
|
| |
8
|
Anders Bondorf and Jesper Jorgensen. Efficient analyses for realistic off-line partial evaluation. Journal of Functional Programming, 3(3):315-346, 1993.
|
 |
9
|
|
 |
10
|
|
 |
11
|
|
 |
12
|
|
 |
13
|
|
 |
14
|
|
 |
15
|
|
| |
16
|
|
| |
17
|
Carsten K. Gomaxd and Nell D. Jones. A partial evaluator for the untyped lambda-calculus. Journal of Functional Programming, 1(1):21-69, 1991.
|
 |
18
|
|
| |
19
|
|
| |
20
|
Thomas Johnsson. Compiling Lazy Functional Languages. PhD thesis, Department of Computer Sciences, Chalmers University of Technology, GSteborg, Sweden, 1987.
|
| |
21
|
|
| |
22
|
Nell D. Jones, Peter Sestoft, and Harald Sondergaard. MIX: A self-applicable partial evaluator for experiments in compiler generation. LISP and Symbolic Computation, 2(1):9-50, 1989.
|
 |
23
|
|
| |
24
|
Kaxoline Malmkj~er, Nevin Heintze, and Olivier Danvy. ML partial evaluation using set-based analysis. In John Reppy, editor, Record of the 199,4 A CM SIG- PLAN Workshop on ML and its Applications, Rapport de recherche N~ 2,265, INRIA, pages 112-119, Orlando, Florida, June 1994. Also appears as Technical report CMU-CS-94-129.
|
 |
25
|
Karoline Malmkjær , Peter Ørbæk, Polyvariant specialisation for higher-order, block-structured languages, Proceedings of the 1995 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, p.66-76, June 21-23, 1995, La Jolla, California, United States
[doi> 10.1145/215465.215558]
|
 |
26
|
Simon Peyton Jones , Will Partain , André Santos, Let-floating: moving bindings to give faster programs, Proceedings of the first ACM SIGPLAN international conference on Functional programming, p.1-12, May 24-26, 1996, Philadelphia, Pennsylvania, United States
|
| |
27
|
|
| |
28
|
|
| |
29
|
|
| |
30
|
Erik Ruff Topzes in Online Partial Evaluation. PhD thesis, Stanford University, Stanford. California, February 1993. Technical report CSL-TR-93-563.
|
 |
31
|
|
| |
32
|
Ulrik P. Schultz. Master's thesis, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, June 1997. Forthcoming.
|
 |
33
|
|
 |
34
|
|
| |
35
|
|
| |
36
|
Carolyn L. TaIcott, editor. Proceedings of the 1994 A CM Conference on Lisp and Functional Programming, LISP Pointers, Vol. VII, No. 3, Orlando, Florida, June 1994. ACM Press.
|
 |
37
|
|
| |
38
|
|
 |
39
|
|
|