One VM to Rule Them All
📜 Abstract
Building high-performance virtual machines is a complex and expensive undertaking; many popular languages still have low-performance implementations. We describe a new approach to virtual machine (VM) construction that amortizes much of the effort in initial construction by allowing new languages to be implemented with modest additional effort. The approach relies on abstract syntax tree (AST) interpretation where a node can rewrite itself to a more specialized or more general node, together with an optimizing compiler that exploits the structure of the interpreter. The compiler uses speculative assumptions and deoptimization in order to produce efficient machine code. Our initial experience suggests that high performance is attainable while preserving a modular and layered architecture, and that new high-performance language implementations can be obtained by writing little more than a stylized interpreter.
✨ Summary
The paper introduced the Truffle/Graal approach: language implementations provide AST interpreters with self-specializing nodes, while partial evaluation, speculative optimization, and deoptimization are reused across languages. The approach subsequently became the basis for a broad family of Truffle-based implementations, including GraalJS, GraalPy, TruffleRuby, FastR, Sulong, and Espresso, as documented by the GraalVM project. (graalvm.org)
Later research by members of the same project developed the approach further in “Practical Partial Evaluation for High-performance Dynamic Language Runtimes,” which refined the compilation techniques underlying Truffle language implementations. (hirschfeld.org) The paper also influenced industry-oriented adoption: an Oracle Developers presentation documents Goldman Sachs’ use of Truffle and Graal to implement its internal language on the JVM. (youtube.com)