An intermediate representation for speculative optimizations in a dynamic compiler

We present a compiler intermediate representation (IR) that allows dynamic speculative optimizations for high-level languages. The IR is graph-based and contains nodes fixed to control flow as well as floating nodes. Side-effecting nodes include a framestate that maps values back to the original program. Guard nodes dynamically check assumptions and, on failure, deoptimize to the interpreter that continues execution. Guards implicitly use the framestate and program position of the last side-effecting node. Therefore, they can be represented as freely floating nodes in the IR. Exception edges are modeled as explicit control flow and are subject to full optimization. We use profiling and deoptimization to speculatively reduce the number of such edges. The IR is the core of a just-in-time compiler that is integrated with the Java HotSpot VM. We evaluate the design decisions of the IR using major Java benchmark suites.

[1]  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..

[2]  Bruno Blanchet,et al.  Escape analysis for JavaTM: Theory and practice , 2003, TOPL.

[3]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.

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

[5]  Cliff Click,et al.  Global code motion/global value numbering , 1995, PLDI '95.

[6]  Cliff Click,et al.  A simple graph-based intermediate representation , 1995 .

[7]  Hanspeter Mössenböck,et al.  Run-Time Support for Optimizations Based on Escape Analysis , 2007, International Symposium on Code Generation and Optimization (CGO'07).

[8]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1984, TOPL.

[9]  Richard Johnson,et al.  The Transmeta Code Morphing/spl trade/ Software: using speculation, recovery, and adaptive retranslation to address real-life challenges , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[10]  Kei Hiraki,et al.  Sentinel PRE: hoisting beyond exception dependency with dynamic deoptimization , 2005, International Symposium on Code Generation and Optimization.

[11]  Wen-mei W. Hwu,et al.  Field-testing IMPACT EPIC research results in Itanium 2 , 2004, Proceedings. 31st Annual International Symposium on Computer Architecture, 2004..

[12]  Vijay Sundaresan,et al.  Removing redundancy via exception check motion , 2008, CGO '08.

[13]  Mikko H. Lipasti,et al.  Speculative optimization using hardware-monitored guarded regions for java virtual machines , 2007, VEE '07.

[14]  Chen Ding,et al.  Fast Track: A Software System for Speculative Program Optimization , 2009, 2009 International Symposium on Code Generation and Optimization.

[15]  Hanspeter Mössenböck,et al.  Graal IR : An Extensible Declarative Intermediate Representation , 2013 .

[16]  David Schneider,et al.  The efficient handling of guards in the design of RPython's tracing JIT , 2012, VMIL '12.

[17]  Denis Barthou,et al.  Compositional approach applied to loop specialization , 2009 .

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

[19]  Richard Johnson,et al.  The Transmeta Code Morphing#8482; Software: using speculation, recovery, and adaptive retranslation to address real-life challenges , 2003, CGO.

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

[21]  Escape Analysis for Java. Theory and Practice , 2003 .

[22]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[23]  Jong-Deok Choi,et al.  Efficient and precise modeling of exceptions for the analysis of Java programs , 1999, PASTE '99.

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

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

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