Run-Time Specialization

Specialization has a long history in the field of partial evaluation, in which specialization was traditionally applied as a static source-to-source transformation. Specialization is known to be effective at eliminating overhead due to abstraction and generalization.

Run-time specializers are organized similarly to off-line partial-evaluation systems, which perform a binding-time analysis to determine which values throughout the program are known given a set of root values for which the program is to be specialized. The result of the analysis is a division of known (also called static) and unknown (also called dynamic) data at each program point. The values of known data can be used to perform operations at specialization time, while the unknown data can only be used by the specialized code at execution time.

Polyvariant division allows the same program point to be statically analyzed for different combinations of variables being treated as known. Polyvariant specialization allows multiple dynamically compiled versions of code to be produced using a single set of known variables, each specialized for different values of the known variables. Polyvariant specialization is what enables, for example, full loop unrolling when given the loop bounds; the body of the loop is specialized for each value of the loop induction variable.

DyC supports both polyvariant specialization and polyvariant division at arbitrary program points, not just function entries as other declarative dynamic-compilation systems do. Because these powerful transformations have a significant cost, DyC provides control over the aggressiveness of specialization through declarative policies, allowing the user to selectively apply code-duplicating (i.e., specializing) transformations.

Last updated December 3, 1997.
Brian Grant (