Array bounds check elimination in the context of deoptimization

Whenever an array element is accessed, Java virtual machines execute a compare instruction to ensure that the index value is within the valid bounds. This reduces the execution speed of Java programs. Array bounds check elimination identifies situations in which such checks are redundant and can be removed. We present an array bounds check elimination algorithm for the Java HotSpot(TM) VM based on static analysis in the just-in-time compiler. The algorithm works on an intermediate representation in static single assignment form and maintains conditions for index expressions. It fully removes bounds checks if it can be proven that they never fail. Whenever possible, it moves bounds checks out of loops. The static number of checks remains the same, but a check inside a loop is likely to be executed more often. If such a check fails, the executing program falls back to interpreted mode, avoiding the problem that an exception is thrown at the wrong place. The evaluation shows a speedup near to the theoretical maximum for the scientific SciMark benchmark suite and also significant improvements for some Java Grande benchmarks. The algorithm slightly increases the execution speed for the SPECjvm98 benchmark suite. The evaluation of the DaCapo benchmarks shows that array bounds checks do not have a significant impact on the performance of object-oriented applications.

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

[2]  Christopher A. Vick,et al.  The Java HotSpotTM Server Compiler , 2001 .

[3]  Vivek Sarkar,et al.  ABCD: eliminating array bounds checks on demand , 2000, PLDI '00.

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

[5]  Michael D. Ernst Papers from the 1995 ACM SIGPLAN workshop on Intermediate representations , 1995, POPL 1995.

[6]  Keith H. Randall,et al.  Field analysis: getting useful and low-cost interprocedural information , 2000, PLDI '00.

[7]  Songtao Xia,et al.  Towards array bound check elimination in Java TM virtual machine language , 1999, CASCON.

[8]  Hanspeter Mössenböck,et al.  Array bounds check elimination for the Java HotSpot#8482; client compiler , 2007, PPPJ.

[9]  Mike Bauer,et al.  Proceedings of the 2001 conference of the Centre for Advanced Studies on Collaborative Research, November 5-7, 2001, Toronto, Ontario, Canada , 2001, CASCON.

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

[11]  Rajiv Gupta A fresh look at optimizing array bound checking , 1990, PLDI '90.

[12]  László Böszörményi,et al.  The School of Niklaus Wirth, "The Art of Simplicity" , 2000 .

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

[14]  Aneesh Aggarwal,et al.  Related field analysis , 2001, PLDI '01.

[15]  Rajiv Gupta,et al.  Optimizing array bound checks using flow analysis , 1993, LOPL.

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

[17]  Urs Hölzle,et al.  Optimizing dynamically-dispatched calls with run-time type feedback , 1994, PLDI '94.

[18]  Alexandru Nicolau,et al.  Annotating the Java bytecodes in support of optimization , 1997 .

[19]  Vitaly V. Mikheev,et al.  Effective Enhancement of Loop Versioning in Java , 2002, CC.

[20]  Keith D. Cooper,et al.  Value Numbering , 1997, Softw. Pract. Exp..

[21]  Martin D. Westhead,et al.  A benchmark suite for high performance Java , 2000, Concurr. Pract. Exp..

[22]  Robert Griesemer,et al.  A Compiler for the Java HotSpotTM Virtual Machine , 2000, The School of Niklaus Wirth.

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

[24]  Laurie J. Hendren,et al.  A Comprehensive Approach to Array Bounds Check Elimination for Java , 2002, CC.

[25]  Mikhail Dmitriev,et al.  Safe class and data evolution in large and long-lived Java applications , 2001 .

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

[27]  Toshio Nakatani,et al.  Effective null pointer check elimination utilizing hardware trap , 2000, ASPLOS 2000.

[28]  Vivek Sarkar,et al.  The Jalape ~ no Dynamic Optimizing Compiler for Java TM , 1999 .