[jdk17u-dev] RFR: 8338379: Accesses to class init state should be properly synchronized

Matt duke at openjdk.org
Thu Apr 10 14:55:47 UTC 2025


On Tue, 8 Apr 2025 08:37:08 GMT, Jaroslav Bachorik <jbachorik at openjdk.org> wrote:

>> 8338379: Accesses to class init state should be properly synchronized
>
> src/hotspot/cpu/x86/templateTable_x86.cpp line 3944:
> 
>> 3942:   assert(VM_Version::supports_fast_class_init_checks(), "must support fast class initialization checks");
>> 3943:   __ clinit_barrier(rcx, r15_thread, nullptr /*L_fast_path*/, &slow_case);
>> 3944: #else
> 
> This seems to be unrelated to this backport - this change was added for https://bugs.openjdk.org/browse/JDK-8320276

Good call - though we still need to layer this commit to mitigate the ARM races we were seeing. I'll open a separate backport.

> src/hotspot/share/oops/instanceKlass.hpp line 551:
> 
>> 549:   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
>> 550:   ClassState  init_state() const           { return (ClassState) Atomic::load_acquire(&_init_state); }
>> 551:   const char* init_state_name() const;
> 
> This line change is not from the original changeset. It was added in https://bugs.openjdk.org/browse/JDK-8275775

As this is a somewhat separate change (enhancing `jcmd`), I opted to only include the change relevant to the race condition fix. I'll ask for maintainer input on the mailing list and backport `JDK-8275775` in its entirety if that's preferred.

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

PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/3317#discussion_r2037618441
PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/3317#discussion_r2037616730


More information about the jdk-updates-dev mailing list