On Wed, 21 Oct 2026 02:26:26 GMT, Yasumasa Suenaga <[email protected]> wrote:

>> Valhalla introduced flattened value object, however SA cannot dump it into 
>> heapdump e.g. `jhsdb jmap --binaryheap`.
>> Actually HeapHprofBinWriter.java has following lines. Hence the user cannot 
>> check flattened object from heapdump generated by SA.
>> 
>> 
>>         case JVM_SIGNATURE_CLASS:
>>         case JVM_SIGNATURE_ARRAY: {
>>             if (field.isFlat()) {
>>               // FIXME - we don't handle flattened fields yet. Just treat 
>> them
>>               // as a null reference. See JDK-8381370.
>>               writeObjectID(null);
>> 
>> 
>> This PR addressed it.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Yasumasa Suenaga has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains four additional 
> commits since the last revision:
> 
>  - Re-enable HeapDumpTestWithActiveProcess.java
>  - Merge branch 'master' into JDK-8381370
>  - Use getFieldHolder() rather than getKlass()
>  - 8381370: SA is not writing out flattened fields to the hprof file

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
 line 1301:

> 1299:               long id = generateIDForFlatObj();
> 1300:               flatObjects.push(new DumperFlatObject(id, fieldKlass, 
> (FlattenedValue)((OopField)field).getValue(oop)));
> 1301:               writeObjectID(id);

The GXL code needs something similar to this, but that can probably be a 
separate CR, and maybe not worth ever implementing. Also optional is an 
intermediate step that writes out a null ID for flattened references similar to 
the writeObjectID(null) that used to be done here for flat arrays. For GXL it 
would look something like:


        // emit a node for null
        out.print("<node id='");
        out.print(getID(null));
        out.println("'/>");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33395#discussion_r4342405915

Reply via email to