RFR(M): 8137168: Replace IfNode with a new RangeCheckNode for range checks

Roland Westrelin roland.westrelin at oracle.com
Fri Sep 25 15:04:45 UTC 2015

This code adds a new ideal node, RangeCheckNode that is inserted during parsing when a range check is emitted. The entire change is code refactoring to accommodate the new node. This is preparation work for 8042997 and 8135248.

8135248 will add a new method to java.util.Arrays:

int checkIndex(int index, int length,
               OutOfBoundsToException<T> oobe) throws T, IndexOutOfBoundsException {
    if (index < 0 || index >= length)
        throw outOfBounds(index, length, length, oobe);
    return index;

8042997 will intrinsify that method and translate it into a CmpU + RangeCheckNode.

The benefit of the RangeCheckNode is that it will help the compiler locate range checks to optimize even if they don’t strictly follow the pattern of a range check: CmpU + IfNode + LoadRange. The idea of using a node specifically for range checks is from John. 



More information about the hotspot-compiler-dev mailing list