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

Leonid Mesnik lmesnik at openjdk.org
Thu Nov 13 16:33:03 UTC 2025


On Mon, 10 Nov 2025 20:54:56 GMT, Alex Menkov <amenkov 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

Changes requested by lmesnik (Reviewer).

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.

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

PR Review: https://git.openjdk.org/jdk/pull/28224#pullrequestreview-3460651314
PR Review Comment: https://git.openjdk.org/jdk/pull/28224#discussion_r2524138908


More information about the hotspot-dev mailing list