Context-sensitive trace inlining for Java☆

Method inlining is one of the most important optimizations in method-based just-in-time (JIT) compilers. It widens the compilation scope and therefore allows optimizing multiple methods as a whole, which increases the performance. However, if method inlining is used too frequently, the compilation time increases and too much machine code is generated. This has negative effects on the performance. Trace-based JIT compilers only compile frequently executed paths, so-called traces, instead of whole methods. This may result in faster compilation, less generated machine code, and better optimized machine code. In the previous work, we implemented a trace recording infrastructure and a trace-based compiler for JavaTM, by modifying the Java HotSpot VM. Based on this work, we evaluate the effect of trace inlining on the performance and the amount of generated machine code. Trace inlining has several major advantages when compared to method inlining. First, trace inlining is more selective than method inlining, because only frequently executed paths are inlined. Second, the recorded traces may capture information about virtual calls, which simplify inlining. A third advantage is that trace information is context sensitive so that different method parts can be inlined depending on the specific call site. These advantages allow more aggressive inlining while the amount of generated machine code is still reasonable. We evaluate several inlining heuristics on the benchmark suites DaCapo 9.12 Bach, SPECjbb2005, and SPECjvm2008 and show that our trace-based compiler achieves an up to 51% higher peak performance than the method-based Java HotSpot client compiler. Furthermore, we show that the large compilation scope of our trace-based compiler has a positive effect on other compiler optimizations such as constant folding or null check elimination.

[1]  Hanspeter Mössenböck,et al.  Trace-based compilation for the Java HotSpot virtual machine , 2011, PPPJ.

[2]  Hanspeter Mössenböck,et al.  Optimized interval splitting in a linear scan register allocator , 2005, VEE '05.

[3]  Robert Griesemer Generation of Virtual Machine Code at Startup , 1999 .

[4]  Tarek S. Abdelrahman,et al.  The Use of Traces for Inlining in Java Programs , 2004, LCPC.

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

[6]  John Whaley Partial method compilation using dynamic profile information , 2001, OOPSLA '01.

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

[8]  Hanspeter Mössenböck,et al.  Evaluation of trace inlining heuristics for Java , 2012, SAC '12.

[9]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[10]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[11]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[12]  Michael Franz,et al.  Incremental Dynamic Code Generation with Trace Trees , 2006 .

[13]  Toshio Nakatani,et al.  A trace-based Java JIT compiler retrofitted from a method-based compiler , 2011, International Symposium on Code Generation and Optimization (CGO 2011).

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

[15]  David Grove,et al.  Adaptive online context-sensitive inlining , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[16]  Stephen J. Fink,et al.  Design, implementation and evaluation of adaptive recompilation with on-stack replacement , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

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

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

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

[20]  Toshiaki Yasue,et al.  A region-based compilation technique for dynamic compilers , 2006, TOPL.

[21]  Michael Franz,et al.  Trace-based compilation in execution environments without interpreters , 2010, PPPJ.

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

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

[24]  Toshio Nakatani,et al.  Reducing trace selection footprint for large-scale Java applications without performance loss , 2011, OOPSLA '11.