On Fri, 28 Aug 2026 12:20:21 GMT, Coleen Phillimore <[email protected]> wrote:

>> @coleenp Would it be possible to provide a summary on the how this changes 
>> HRPOF heap dumps and JVMTI heap walking tools?
>> 
>> I'm wondering about tools that use functions like FollowReferences to follow 
>> refs. If a ClassLoader object is encountered today then it will follow the 
>> refs to all classes defined by that class loader. With the change then it 
>> won't do that, is that right? I'm wondering if the refs will need to be 
>> synthesized to avoid breakage.
>
> @AlanBateman you are right that heapdump and followrefs tools will not visit 
> the class after visiting the class loader with this change. They'll still 
> visit the class loader with the class.  I'm still trying to work out how to 
> describe this change in behavior for these tools and maybe have a CSR for it. 
>  There was only one test left that failed because of this change - was hoping 
> some hprof test would fail so I could see the effect of that. I'm still 
> working on this though, but I wanted to publicize the change first.

@coleenp I see the latest proposal synthesizes a ref from a class loader to 
defined clases via a heap ref callback invoked with a ref kind of 
JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT. I don't think this is semantically correct 
because this ref kind is for when the referrer is an object array, and a 
ClassLoader object is not an array.

This case is begging to use JVMTI_HEAP_REFERENCE_OTHER but unfortunately that 
ref kind is specified for "root objects" so I think could be problematic to 
re-specify for other cases. Introducing a new ref kind to deal with "none of 
the above" types of refs would be feasible but would require a survey of 
existing agents to know how they might behave with a new ref kind.

I don't think JVMTI_HEAP_REFERENCE_FIELD is feasible either because spec 
provides an ordering guarantee with GetClassFields. 

One thing to try is to put an Object field in ClassLoader (explicitly or 
inject) and treat it as an Object[]. That would give you a callback from the 
ClassLoader object -> dummy field and an JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT ref 
from the array to each classes.

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

PR Comment: https://git.openjdk.org/jdk/pull/32519#issuecomment-5537534135

Reply via email to