Speaker: Mark Leone, CMU (joint work with Peter Lee)
A Declarative Approach to Run-Time Code GenerationDate: February 15, 1996
Abstract: Run-time code generation promises to improve the performance and reliability of current and future systems. Optimizations performed at run time make use of values and invariants that cannot be exploited at compile time, yielding code that is superior to statically optimal code.
Most previous approaches to run-time code generation have been _imperative_. The programmer is responsible for specifying the code to be optimized at run time (often as a "template" of machine code), performing certain optimizations, insuring that dynamically constructed code is well formed, invoking a compiler and dynamically linking to the resulting code, and insuring correctness by invalidating or updating code when the values used to optimize it change.
Each of these duties is laborious and error prone. Various ad-hoc techniques have been suggested to ameliorate the situation, but we believe that this imperative approach is inherently clumsy and unsafe.
We advocate a _declarative_ approach to run-time code generation: the programmer should express algorithms in a high-level language that permits the _compiler_ to discover and safely exploit opportunities for dynamic optimization. The key benefits of a declarative approach to run-time code generation are: