arrow
Return

Partial-Evaluation Templates: Accelerating Partial Evaluation with Pre-compiled Templates

delete2026-01-01
delete0
PRE
AI
F
Florian Huemer *
A
Aleksandar Prokopec
D
David Leopoldseder
R
Raphael Mosaner
H
Hanspeter Mössenböck
DOI:10.1109/CGO68049.2026.11395215delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Partial evaluation allows specializing programs by substituting some of their inputs with static values and evaluating the resulting static expressions. When applied to a language interpreter, it specializes the interpreter to a fixed source program, resulting in a specialized interpreter that existing compilers can optimize and generate efficient machine code for. Although this approach achieves good peak performance in just-in-time compilers, partial evaluation is costly with respect to compilation time. In the case of bytecode interpreters, partial evaluation must process and transform each bytecode instruction. Since instructions with the same opcodes share common functionality, partial evaluation applies the same transformations repeatedly. Consequently, partial evaluation significantly increases the compilation time of just-intime compilation. We propose partial-evaluation templates, i.e., reusable collections of ahead-of-time-compiled graphs that are generated by a hand-written cogen approach. The templates are parametric in their static inputs, and cover common functionality in a bytecode interpreter implementation. At compile time, templates specialize themselves by substituting their static inputs, reducing themselves to a single pre-compiled graph that the compiler inlines and optimizes. This reduces the size of the intermediate representation and speeds up partial evaluation, as well as optimizations. We integrated our approach into GraalVM, a state-of-the-art high-performance polyglot virtual machine, and GraalWasm, a bytecode-interpreter-based WebAssembly runtime. We extended the existing GraalVM compiler with a binding-time analysis that generates the templates and introduced a specializer for the templates into the existing partial evaluator. We enabled template generation for nearly all opcodes in GraalWasm, which reduced partial-evaluation time by up to 36% and warmup time by up to 17% without impacting peak performance.
Keywords:
partial evaluation
binding-time analysis
cogen
templates
GraalVM
virtual machines
escape analysis

Journal

2
2026 IEEE/ACM INTERNATIONAL SYMPOSIUM ON CODE GENERATION AND OPTIMIZATION, CGO
IF:
0
Papers:
48
Citations:
0

Organization

J
johannes kepler university linz
Scholars:
855
Papers: 361
Citations: 0
Cited Papers

Cited Papers

An experiment in partial evaluation
err1985-08-01
err0
PREAI
errJones,Neil D.; Sestoft,Peter; Søndergaard,Harald
errShare
errSave
One VM to rule them all
err2013-10-29
err0
PREAI
errThomas Würthinger; Christian Wimmer; Andreas Wöß; Lukas Stadler; Gilles Duboscq; Christian Humer; Gregor Richards; Doug Simon; Mario Wolczko
errShare
errSave
Practical partial evaluation for high-performance dynamic language runtimes
err2017-06-14
err0
PREAI
errThomas Würthinger; Christian Wimmer; Christian Humer; Andreas Wöß; Lukas Stadler; Chris Seaton; Gilles Duboscq; Doug Simon; Matthias Grimmer
errShare
errSave
errShare
errSave
err1999-01-01
err0
PREAI
errYoshihiko Futamura
errShare
errSave
researcher View more