Efficient interpreter optimizations for the JVM

The Java virtual machine is a popular target for many language implementers. Due to the unusually poor performance of hosted interpreters, many programming language implementers resort to implementing a custom compiler that emits Java bytecode instead. We studied performance of these hosted interpreters targeting the JVM and identified common bottlenecks preventing their efficient execution. First, similar to interpreters written in C/C++, instruction dispatch is expensive on the JVM. Second, Java's array semantics dictate expensive runtime exception checks, which negatively affect array performance essential to interpreters. We present two optimizations targeting these bottlenecks and show that the performance of the optimized interpreters increases dramatically: we report speedups by a factor of up to 2.45 over the Jython interpreter, and 3.57 over the Rhino interpreter respectively. Furthermore, the performance attained through our optimizations is comparable with custom compiler performance. We provide an easily accessible annotation-based interface to enable our optimizations. Thus, interpreter implementers can expect substantial performance boosts in a matter of hours of implementation effort.

[1]  Stefan Brunthaler Virtual-Machine Abstraction and Optimization Techniques , 2009, Electron. Notes Theor. Comput. Sci..

[2]  Hanspeter Mössenböck,et al.  Design of the Java HotSpot#8482; client compiler for Java 6 , 2008, TACO.

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

[4]  Tarek S. Abdelrahman,et al.  Catenation and specialization for Tcl virtual machine performance , 2004, IVME '04.

[5]  Cliff Click,et al.  The Java HotSpot Server Compiler , 2001, Java Virtual Machine Research and Technology Symposium.

[6]  Angela Demke Brown,et al.  Context threading: a flexible and efficient dispatch technique for virtual machine interpreters , 2005, International Symposium on Code Generation and Optimization.

[7]  David Gregg,et al.  Optimizing indirect branch prediction accuracy in virtual machine interpreters , 2003, PLDI '03.

[8]  Xavier Leroy,et al.  Java bytecode verification : algorithms and formalizations Xavier Leroy INRIA Rocquencourt and Trusted Logic , 2003 .

[9]  David Gregg,et al.  The Structure and Performance of Efficient Interpreters , 2003, J. Instr. Level Parallelism.

[10]  Toshio Nakatani,et al.  Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs , 2012, VEE '12.

[11]  Thierry Coupaye,et al.  ASM: a code manipulation tool to implement adaptable systems , 2002 .

[12]  WimmerChristian,et al.  Design of the Java HotSpot client compiler for Java 6 , 2008 .

[13]  Michael Haupt,et al.  Maxine: An approachable virtual machine for, and in, java , 2013, TACO.

[14]  Jan M. Van Campenhout,et al.  Interpretation and instruction path coprocessing , 1990, Computer systems.

[15]  David Gregg,et al.  Virtual machine showdown: stack versus registers , 2005, VEE '05.

[16]  Michael Franz,et al.  Optimization of dynamic languages using hierarchical layering of virtual machines , 2009, DLS '09.

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

[18]  James R. Bell,et al.  Threaded code , 1973, CACM.

[19]  Michael Franz,et al.  Tracing for web 3.0: trace compilation for the next generation web applications , 2009, VEE '09.

[20]  David Gregg,et al.  Combining stack caching with dynamic superinstructions , 2004, IVME '04.

[21]  Peter M. Kogge,et al.  An Architectural Trail to Threaded-Code Systems , 1982, Computer.

[22]  Cliff Click,et al.  The java hotspot TM server compiler , 2001 .