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

Tobias Hartmann tobias.hartmann at oracle.com
Tue May 16 15:49:53 UTC 2017

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,

More information about the hotspot-compiler-dev mailing list