RFR: 8338379: Accesses to class init state should be properly synchronized [v2]

Aleksey Shipilev shade at openjdk.org
Mon Sep 23 07:17:50 UTC 2024


On Mon, 23 Sep 2024 01:46:12 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Relax to just a release
>
> src/hotspot/share/oops/instanceKlass.cpp line 4099:
> 
>> 4097: #endif
>> 4098:   assert(_init_thread == nullptr, "should be cleared before state change");
>> 4099:   Atomic::release_store_fence(&_init_state, state);
> 
> Why not just a release_store ?? Why do we need the trailing fence?

Says in PR: "Current patch makes a seqcst write, which is stronger than strictly necessary. I think it is okay to be extra paranoid on rarely-executed class initialization path." But I can turn it into just a weaker release, sure.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21110#discussion_r1770871023


More information about the hotspot-dev mailing list