[9] RFR(S): 8158228: C1 incorrectly folds mismatched loads from stable arrays

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Jun 3 10:26:09 UTC 2016


>>> Like this we still have optimal code. What do you think?
>> I suggest to completely disable constant folding in Canonicalizer::do_LoadIndexed if LoadIndexed node is marked as mismatched.
>>
>> Please, leave ciArray::element_value_impl as is.
>
> Okay, I noticed that C2 also does not fold mismatched accesses. Could you please explain why that is?

Primarily to keep the code sane :-) Unsafe accesses are the source of 
mismatched accesses and additional checks are required to filter out all 
problematic cases. So, I decided to leave them out when enabled constant 
folding of unsafe loads. My main motivation for the change was to make 
method handles for field / array element accesses as fast as using 
bytecode, and mismatched accesses didn't justify all the complications 
they cause.

> Here's the new webrev:
> http://cr.openjdk.java.net/~thartmann/8158228/webrev.02/

Looks good.

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list