RFR: 8333791: Fix memory barriers for @Stable fields [v3]

Chen Liang liach at openjdk.org
Fri Aug 16 04:42:01 UTC 2024


On Fri, 16 Aug 2024 04:28:41 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>> 
>>  - Use TestFramework bootclasspath instead of develop option
>>  - Merge branch 'master' into JDK-8333791-stable-field-barrier
>>  - Merge branch 'master' into JDK-8333791-stable-field-barrier
>>  - Merge branch 'master' into JDK-8333791-stable-field-barrier
>>  - Merge branch 'master' into JDK-8333791-stable-field-barrier
>>  - Variant 2: Only final-field like semantics for stable inits
>>  - Variant 3: Handle everything, including reads by compilers
>
> src/hotspot/share/c1/c1_GraphBuilder.cpp line 1752:
> 
>> 1750:       scope()->set_wrote_final();
>> 1751:     }
>> 1752:     if (field->is_stable()) {
> 
> What if the `field` is a field of another object, not the one in construction? For final fields the verifier ensures that we only write to it in the containing object constructor, but for final fields it is not guaranteed.

Isn't membar additions already checked with `is_object_initializer()` or `method()->name() == ciSymbols::object_initializer_name()`?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19635#discussion_r1719289420


More information about the hotspot-dev mailing list