Array bounds check elimination for the Java HotSpot#8482; client compiler

Array bounds check elimination for the Java HotSpot#8482; client compiler
复制标题

Java HotSpot 的数组边界检查消除

DOI:
--
复制
发表时间:
2007
期刊:
Principles and Practice of Programming in Java
影响因子:
--
通讯作者:
H. Mössenböck
H. Mössenböck
中科院分区:
--
文献类型:
--
作者:
Thomas Würthinger;Christian Wimmer;H. Mössenböck

文献摘要

被引文献

相似文献

每当访问数组元素时,Java虚拟机都会执行比较指令,以确保索引值在有效的范围内。这降低了Java程序的执行速度。数组边界检查消除识别此类检查是多余的情况,可以删除。我们提出了Java热点#8482的数组界限删除算法; VM基于即时编译器中的静态分析。 该算法以静态单分配形式的中间表示作用,并保持索引表达式的条件。它完全删除了界限检查是否可以证明它们永远不会失败。只要可能,它就会移动边界退出循环。静态检查数量保持不变,但是在循环内部进行检查可能会更频繁地执行。如果这样的支票失败,执行程序将恢复到解释的模式,避免了在错误的位置抛出异常的问题。 评估显示了科学Scimark基准套件的理论最大值接近的加速度(平均为40%)。该算法还提高了SPECJVM98基准套件的执行速度(平均2%,最高12%)。
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#8482; 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 (40% on average). The algorithm also improves the execution speed for the SPECjvm98 benchmark suite (2% on average, 12% maximum).