Improving the Accuracy of Higher-Order Specialization using Control Flow Analysis

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.