Meta-Tracing's Ancestry: Partial Evaluation's Influence
Meta-tracing builds upon concepts from partial evaluation, a program transformation technique. Both meta-tracing and partial evaluation (especially in the context of projects like Truffle/Graal) can be seen as examples of Futamura projection, where an interpreter is specialized to produce a compiler.
The top 3
- Futamura Projections: Compilers from Interpreters: Yoshihiko Futamura's 1971 work introduced three 'projections' demonstrating how partial evaluation can mechanically derive an optimized executable from an interpreter and source code (first projection), a compiler from an interpreter and a partial evaluator (second), and even a compiler generator (third).
- Binding-Time Analysis: The Specialization Engine: The practical core of partial evaluation is 'binding-time analysis' (BTA), which classifies program parts as 'static' (computable at specialization time) or 'dynamic' (requiring runtime values). This allows the partial evaluator to precompute static operations and generate a specialized 'residual program' for dynamic ones.
- Meta-Tracing vs. Partial Evaluation: Two JIT Paths: While both meta-tracing (like PyPy) and partial evaluation (like GraalVM's Truffle) optimize interpreters, they represent different approaches. PyPy's meta-tracing emerged after initial partial evaluation attempts were less successful, focusing on optimizing frequently executed 'traces' or paths. Partial evaluation, conversely, abstracts over multiple executions to specialize programs more broadly.
Sources
Open the full topic