Skip to main content

Array bound check elimination and HotSpot

3 replies [Last post]
stuartwi
Offline
Joined: 2006-08-28

I have a question regarding array bounds check elimination, specifically what kinds of array bounds check elimination that different HotSpot implementations attempt.

If an array index is ANDed with value that guarantees that the array index in within the bounds of the array, can HotSpot eliminate the array bounds check?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mthornton
Offline
Joined: 2003-06-10

Actually array access #1 and #3 are good candidates for elimination. With a little rearrangement you might be able to convince the current HotSpot to eliminate those checks. Both cases access arrays sequentially and you can determine up front how many iterations through the loop are possible without exceeding the array bounds.

stuartwi
Offline
Joined: 2006-08-28

mthornton-

Thank you for your reply.

I agree with you, and am happy to hear it, but it is not what I have been seeing on the platform I mentioned (although Win2K is not the platform I care about most). I haven't had a chance to check HotSpot output on a *nix x86 platform with -server, but since I didn't see the right thing happening on Win2K, I thought I'd post to the forum.

Do you have any tips on what one should do to get HotSpot to do the right thing?

Thanks!

linuxhippy
Offline
Joined: 2004-01-07

why did you remove the source? Today I thought about looking at it, but it has already been removed :-/