RFR: 8371083: FollowReferences reports non-class objects as JVMTI_HEAP_REFERENCE_SYSTEM_CLASS

Alex Menkov amenkov at openjdk.org
Thu Nov 13 19:21:19 UTC 2025


On Thu, 13 Nov 2025 16:30:28 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> FollowReferences with null initial_object starts heap walking from "heap roots", which include system classes.
>> All oops from ClassLoaderDataGraph are reported with JVMTI_HEAP_REFERENCE_SYSTEM_CLASS kind, but some of the objects are not classes.
>> The fix updates FollowReferences to report non-class objects from ClassLoaderDataGraph as JVMTI_HEAP_REFERENCE_OTHER
>> 
>> Testing: tier1..4,hs-tier5-svc
>
> 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)

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

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


More information about the hotspot-dev mailing list