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

Tobias Hartmann tobias.hartmann at oracle.com
Tue Nov 3 10:10:57 UTC 2015


Hi Roland,

I think this is a really nice feature allowing the compiler to optimize custom range checks in the library code.

The code looks good to me. Here are some minor comments (you don't need to send another webrev):

loopUnswitch.cpp: Please add brackets (for readability) here 
239   IfNode* iff = opcode == Op_RangeCheck ?

loopopts.cpp: Please add brackets here
1947   IfNode* new_if = opcode == Op_If ?

multnode.cpp: Please add spaces here:
(which_proj?Op_IfTrue:Op_IfFalse)

In general: Not sure if there is an official rule for this but I prefer 'Node* ' over 'Node * '. At least we should be consistent for the newly added code.

Best,
Tobias

On 25.09.2015 17:04, Roland Westrelin wrote:
> 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. 
> 
> http://cr.openjdk.java.net/~roland/8137168/webrev.00/
> 
> Roland.
> 


More information about the hotspot-compiler-dev mailing list