RFR: 8182036: Load from initializing arraycopy uses wrong memory state
Yangfei (Felix)
felix.yang at huawei.com
Thu Sep 16 06:58:55 UTC 2021
Hi,
> -----Original Message-----
> From: Roland Westrelin [mailto:rwestrel at redhat.com]
> Sent: Wednesday, September 15, 2021 4:53 PM
> To: Yangfei (Felix) <felix.yang at huawei.com>; Hohensee, Paul
> <hohensee at amazon.com>; jdk8u-dev <jdk8u-dev at openjdk.java.net>
> Subject: RE: RFR: 8182036: Load from initializing arraycopy uses wrong
> memory state
>
>
>
> > Thanks for looking at this.
> > Could I have another review from some C2 experts please?
>
> Sorry I missed that one back then.
>
> The fix itself looks good but I'm surprised the change to memnode.cpp is not
> required. Do you understand why it's not?
The change in memnode.cpp of the original patch modifies the condition of the assertion.
For jdk10+, the assertion is located in a loop and the loop condition looks like [1].
For jdk8u, this loop is not there and the assertion is simply in an if statement like [2].
Also the condition for the loop and if statement is rather different:
For jdk8u, we have this condition for the if statement: mem->in(MemNode::Address)->eqv_uncast(address).
In this case, 'mem' is the StoreL node from the ClearArrayNode, as explained in [3]. And 'address' corresponds to the StoreI node.
Since those two store nodes access different memory, the condition will be false and the assertion for jdk8u will not hit in this case.
That's why I excluded the change for jdk8u. I should have mentioned this in my original email.
Thanks,
Felix
[1] https://hg.openjdk.java.net/jdk10/jdk10/hotspot/file/5ab7a67bc155/src/share/vm/opto/memnode.cpp#l2424
[2] https://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/file/3ba3f0e3f6c5/src/share/vm/opto/memnode.cpp#l2482
[3] https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2017-June/026479.html
More information about the jdk8u-dev
mailing list