Tracing vs. partial evaluation: comparing meta-compilation approaches for self-optimizing interpreters

Tracing and partial evaluation have been proposed as meta-compilation techniques for interpreters to make just-in-time compilation language-independent. They promise that programs executing on simple interpreters can reach performance of the same order of magnitude as if they would be executed on state-of-the-art virtual machines with highly optimizing just-in-time compilers built for a specific language. Tracing and partial evaluation approach this meta-compilation from two ends of a spectrum, resulting in different sets of tradeoffs. This study investigates both approaches in the context of self-optimizing interpreters, a technique for building fast abstract-syntax-tree interpreters. Based on RPython for tracing and Truffle for partial evaluation, we assess the two approaches by comparing the impact of various optimizations on the performance of an interpreter for SOM, an object-oriented dynamically-typed language. The goal is to determine whether either approach yields clear performance or engineering benefits. We find that tracing and partial evaluation both reach roughly the same level of performance. SOM based on meta-tracing is on average 3x slower than Java, while SOM based on partial evaluation is on average 2.3x slower than Java. With respect to the engineering, tracing has however significant benefits, because it requires language implementers to apply fewer optimizations to reach the same level of performance.

[1]  Christian Wimmer,et al.  Self-optimizing AST interpreters , 2012, DLS.

[2]  Craig Chambers,et al.  Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches , 1991, ECOOP.

[3]  Christian Wimmer,et al.  ZipPy on truffle: a fast and simple implementation of python , 2013, SPLASH.

[4]  Samuele Pedroni,et al.  PyPy's approach to virtual machine construction , 2006, OOPSLA '06.

[5]  Hanspeter Mössenböck,et al.  An object storage model for the truffle language implementation framework , 2014, PPPJ '14.

[6]  Lennart Augustsson Partial evaluation in aircraft crew planning , 1997 .

[7]  Michael Leuschel,et al.  Towards a jitting VM for prolog execution , 2010, PPDP.

[8]  Jan Vitek,et al.  A fast abstract syntax tree interpreter for R , 2014, VEE '14.

[9]  Laurence Tratt,et al.  Storage strategies for collections in dynamically typed languages , 2013, OOPSLA.

[10]  Yoshihiko Futamura,et al.  Parital Computation of Programs , 1982, RIMS Symposium on Software Science and Engineering.

[11]  Christian Wimmer,et al.  A domain-specific language for building self-optimizing AST interpreters , 2015 .

[12]  Gregory T. Sullivan Dynamic Partial Evaluation , 2001, PADO.

[13]  Yoshihiko Futamura,et al.  Partial Evaluation of Computation Process--An Approach to a Compiler-Compiler , 1999, High. Order Symb. Comput..

[14]  Per Larsen,et al.  Accelerating iterators in optimizing AST interpreters , 2014, OOPSLA 2014.

[15]  Stefan Marr,et al.  Are We There Yet?: Simple Language Implementation Techniques for the 21st Century , 2014, IEEE Software.

[16]  Hanspeter Mössenböck,et al.  Context-sensitive trace inlining for Java☆ , 2013, Comput. Lang. Syst. Struct..

[17]  Stéphane Ducasse,et al.  Zero-overhead metaprogramming: reflection and metaobject protocols fast and without compromises , 2015, PLDI.

[18]  Nikolai Tillmann,et al.  SPUR: a trace-based JIT compiler for CIL , 2010, OOPSLA.

[19]  David Gregg,et al.  Optimizing indirect branch prediction accuracy in virtual machine interpreters , 2007, ACM Trans. Program. Lang. Syst..

[20]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[21]  Michael Haupt,et al.  The SOM family: virtual machines for teaching and research , 2010, ITiCSE '10.

[22]  Stefan Brunthaler,et al.  Efficient interpretation using quickening , 2010, DLS '10.

[23]  Carl Friedrich Bolz,et al.  Tracing the meta-level: PyPy's tracing JIT compiler , 2009, ICOOOLPS@ECOOP.

[24]  Craig Chambers,et al.  An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes , 1991 .

[25]  Akihiko Takano Y.Futamura : Partial Evaluation of Computation Process : An Approach to a Compiler-Compiler , 2002 .

[26]  Laurence Tratt,et al.  The impact of meta-tracing on VM design and implementation , 2015, Sci. Comput. Program..

[27]  Christian Wimmer,et al.  One VM to rule them all , 2013, Onward!.

[28]  Todd A. Proebsting Optimizing an ANSI C interpreter with superoperators , 1995, POPL '95.

[29]  Vasanth Bala,et al.  Dynamo: a transparent dynamic optimization system , 2000, SIGP.

[30]  Michael Franz,et al.  HotpathVM: an effective JIT compiler for resource-constrained devices , 2006, VEE '06.

[31]  Craig Chambers,et al.  Debugging optimized code with dynamic deoptimization , 1992, PLDI '92.