[9] RFR(S): 8179678: ArrayCopy with same src and dst can cause incorrect execution or compiler crash

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue May 16 18:52:03 UTC 2017


Looks good.

Roland, can you move detect_ptr_independence() after instance_id() check? detect_ptr_independence() calls all_controls_dominate() which is expensive.

Thanks,
Vladimir

On 5/16/17 8:49 AM, Tobias Hartmann wrote:
> Hi Roland,
>
> On 16.05.2017 14:22, Roland Westrelin wrote:
>>> But in ArrayCopyNode::can_replace_dest_load_with_src_load() you return
>>> false, if src == dst. Why is that?
>>
>> See test2(): src[0] is the destination of the copy, it is replaced by a
>> read of the source: src[0] which is the destination of the copy... and
>> the compiler is sent into an infinite loop.
>
> Yes but my point was that even if src == dst, it's not necessary the case that the arraycopy affects the offset we are reading from src.
>
> Is the arraycopy still removed in the test2 case?
>
>> This said, this test is too conservative. I've reworked it.
>
> Okay, looks good now.
>
>>> And in line 733, shouldn't we pass must_modify = false to detect the
>>> case we the array copy _may_ modify the source we would load?
>>
>> Yes, you're right. Thanks for spotting that.
>>
>> New webrev:
>>
>> http://cr.openjdk.java.net/~roland/8179678/webrev.01/
>
> Looks good to me!
>
> Best regards,
> Tobias
>


More information about the hotspot-compiler-dev mailing list