RFR: 8327963: C2: fix construction of memory graph around Initialize node to prevent incorrect execution if allocation is removed [v12]
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Wed Sep 24 12:23:00 UTC 2025
On Fri, 19 Sep 2025 12:55:55 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
>> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 45 commits:
>>
>> - more
>> - Merge branch 'master' into JDK-8327963
>> - more
>> - more
>> - Merge branch 'master' into JDK-8327963
>> - more
>> - more
>> - lambda return
>> - lambda clean up
>> - Merge branch 'master' into JDK-8327963
>> - ... and 35 more: https://git.openjdk.org/jdk/compare/e16c5100...b701d03e
>
> src/hotspot/share/opto/macro.cpp line 1606:
>
>> 1604: // elimination. Simply add the MemBarStoreStore after object
>> 1605: // initialization.
>> 1606: MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxRaw);
>
> Does the same argument as below apply for relaxing the scope of this memory barrier? Please clarify in a similar comment for this case (if the same argument applies, a reference to the comment below would be enough).
Thanks for adding the comment. A follow-up question: the full comment below makes the argument that _re-ordering by the compiler can't happen by construction_ because _a later Store that publishes the just allocated object reference is indirectly control dependent on the Initialize node_. However, in this case, there may be no such Initialize node (`init == nullptr || init->req() < InitializeNode::RawStores`). I assume the memory barrier relaxation is still OK in this scenario because we cannot have later, publishing stores of the allocated object reference? That is, if there exists such a store then there must necessarily exist an Initialize node? Or is there any other reason I am missing? It would be good to clarify this point in the comment.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2375585788
More information about the hotspot-compiler-dev
mailing list