On Fri, 14 Aug 2026 21:00:31 GMT, Leonid Mesnik <[email protected]> wrote:
>> src/hotspot/share/services/threadService.cpp line 1511:
>>
>>> 1509: if (lock_klass->should_be_initialized()) {
>>> 1510: lock_klass->initialize(CHECK_NULL);
>>> 1511: }
>>
>> Just before this block is the assignment to lock_klass, and it is only
>> referenced inside this block. Shouldn't the assignment move into this block
>> so the scope of lock_klass is limited to this block? In fact I think all of
>> the following should be moved inside this block:
>>
>> 1502 Symbol* lock_sym = vmSymbols::jdk_internal_vm_ThreadLock();
>> 1503 Klass* lock_k = SystemDictionary::resolve_or_fail(lock_sym, true,
>> CHECK_NULL);
>> 1504 InstanceKlass* lock_klass = InstanceKlass::cast(lock_k);
>
> make sense, fixed
Style nit: I think the init code should immediately follow the
`resolve_or_fail` call, as is done with the `snapshot_klass` class below.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32363#discussion_r3792953285