We have developed a new technique for computing the argument vectors used to build specializations of rst-class functions. Instead of building these specializations on completely dynamic actual parameters, our technique performs a control ow analysis of the residual program as it is constructed during specialization, and uses the results of this analysis to compute more accurate actual parameter values. As implemented in the program specializer FUSE, our technique has proven useful in improving the specialization of several realistic programs taken from the domains of interpreters and scientiic computation. Also, it extends the utility of the continuation-passing-style (CPS) transformation for binding time improvement to programs with non tail-recursive residual loops. Introduction The treatment of function calls in program point specializers for rst-order functional languages is fairly straightforward: since the head of the call always evaluates to a known procedure at specialization time, the specializer is free to either reduce the call, replacing it with the result of unfolding the procedure's body on its argument, or to residualize the call, replacing it with a call to a specialized procedure. Virtually all existing specializers are polyvariant, meaning that the specializer is free (modulo termination issues) to unfold or specialize each procedure an arbitrary number of times on arbitrary argument vectors. Adding rst-class procedures to the language complicates things somewhat. At specialization time, call heads may now evaluate to specialization-time closures or to completely dynamic (unknown) values, in addition to rst-order procedures.
[1]
Anders Bondorf,et al.
Automatic Autoprojection of Higher Order Recursive Equations
,
1990,
Sci. Comput. Program..
[2]
Charles Consel,et al.
Binding time analysis for high order untyped functional languages
,
1990,
LISP and Functional Programming.
[3]
Erik Ruf,et al.
Automatic Online Partial Evaluation
,
1991,
FPCA.
[4]
Daniel Weise,et al.
An Empirical Study of an Abstract Interpretation of Scheme Programs
,
1992
.
[5]
Williams Ludwell HarrisonIII.
The interprocedural analysis and automatic parallelization of Scheme programs
,
1989
.
[6]
R. Schooler,et al.
PARTIAL EVALUATION AS A MEANS OF LANGUAGE EXTENSIBILITY
,
1984
.
[7]
Olin Shivers,et al.
Control-flow analysis of higher-order languages of taming lambda
,
1991
.
[8]
Olivier Danvy,et al.
For a Better Support of Static Data Flow
,
1991,
FPCA.
[9]
Neil D. Jones,et al.
A partial evaluator for the untyped lambda-calculus
,
1991,
Journal of Functional Programming.
[10]
Jr. Guy L. Steele,et al.
Rabbit: A Compiler for Scheme
,
1978
.
[11]
Erik Ruf,et al.
Preserving Information during Online Partial Evaluation
,
1992
.
[12]
Peter Sestoft,et al.
Replacing function parameters by global variables
,
1989,
FPCA.
[13]
Williams Ludwell Harrison,et al.
The interprocedural analysis and automatic parallelization of Scheme programs
,
1990,
LISP Symb. Comput..