We have taken a declarative approach to dynamic compilation, which is compatible with our long-term goal of applying dynamic compilation completely automatically without programmer direction. Like other declarative systems, our dynamic-compilation system is based on run-time specialization, using the run-time values of variables to optimize programs.
Dynamic compilation enables optimizations based on the values of data computed at run time. The dynamic compiler makes a specialized copy of the code for each set of run-time values used in these optimizations, essentially treating the data as constants in each copy. Using the values of these run-time constants, a dynamic compiler can eliminate their memory loads, perform constant propagation and folding, remove branches they determine, and fully unroll loops they bound. These value-based optimizations are the typical ones performed by specialization-based dynamic compilers.
A key aspect of DyC, our dynamic-compilation system, that differentiates it from other declarative systems is that we provide declarative policies to control the most important cost/benefit trade-offs, such as the degree of aggressiveness of specialization or how to cache dynamically generated code.
DyC is further described in our journal publication, while our previous, first-generation system was described in our PLDI `96 paper.