DyC, Our Dynamic-Compilation System
In designing DyC, we have strived
for both fast dynamic compilation and
high-quality dynamically compiled code.
- The programmer annotates regions of the programs that should be
compiled dynamically and variables for which to specialize the regions;
- A static optimizing compiler automatically identifies which data
will have known values at run time, given the values of the annotated
variables, then creates and optimizes machine-code templates;
and
- A post-pass uses these templates to automatically produce
generating extensions that, when executed, produce optimized
executable code at run time.
We have developed a new declarative annotation language and
underlying run-time specialization
primitives that are more expressive, flexible, and controllable than
previous annotation-based systems, while still being easy to use. Our
system supports the following features:
- program-point-specific rather than function-level specialization,
- support for both polyvariant specialization and polyvariant
division (both of which have practical utility), with the degree of
specialization for different variables under programmer control,
- intra- and interprocedural specialization, with caller and callee
separately compilable,
- arbitrarily nested and overlapping regions of dynamically
generated code,
- automatic caching, reuse, and reclamation of dynamically generated
code, with cache policies under control of the programmer,
- automatic interleaving of specialization and dynamic execution to
avoid unbounded static specialization for terminating programs, with
the exact trade-off between speculative specialization and
demand-driven specialization under programmer control,
- automatic interleaving of specialization and dynamic execution to
delay specialization of some code until the appropriate run-time
values of been computed,
- run-time optimizations, including constant propagation, constant
folding, strenth reduction, conditional branch folding and dead-code
elimination, loop unrolling and merge splitting, and procedure-call
specialization.
DyC's design is described in detail in our journal publication.