On Thu, 13 Nov 2025 19:18:38 GMT, Alex Menkov <[email protected]> wrote:

>> test/hotspot/jtreg/serviceability/jvmti/FollowReferences/KindSystemClass/libKindSystemClass.cpp
>>  line 43:
>> 
>>> 41:   switch (reference_kind) {
>>> 42:   case JVMTI_HEAP_REFERENCE_SYSTEM_CLASS:
>>> 43:     *tag_ptr = ++class_counter;
>> 
>> The callback is executed on VMThread, so counters should be atomic or 
>> protected by monitors.
>
> Not sure I follow. There is no concurrent access to the variables.
> FollowReferences is executed at safepoint (so the counters are updated by 
> single thread). The values are read after FollowReference returns (i.e. after 
> the safepoint)

Thanks for explanation. Then it is no need to synchronize.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28224#discussion_r2524733585

Reply via email to