On Fri, 9 Oct 2026 04:17:58 GMT, Serguei Spitsyn <[email protected]> wrote:
>> `flatArrayOopDesc` in HotSpot inherits `objArrayOopDesc`, so I think SA
>> should follow it. Then `isObjArray()` keeps to return `true` in `FlatArray`.
>>
>> I added both `getOopHandleAt()` and `getObjAt()` in new commit. I haven't
>> seen any failures in jtreg tests. They include oop inspection to scan array
>> elements. I'm not sure they are enough, but I believe it passed current
>> criteria.
>
> Thank you for the updates. This sounds reasonable. I still wonder if we have
> test coverage for the `instanceof ObjArray` cases above. One explicit concern
> is for HProf heap dump test coverage for the fragments below:
>
> protected int calculateOopDumpRecordSize(Oop oop) throws IOException {
> if (oop instanceof TypeArray taOop) {
> return calculatePrimitiveArrayDumpRecordSize(taOop);
> } else if (oop instanceof ObjArray oaOop) {
> Klass klass = oop.getKlass();
> ObjArrayKlass oak = (ObjArrayKlass) klass;
> Klass bottomType = oak.getBottomKlass();
> if (bottomType instanceof InstanceKlass ||
> bottomType instanceof TypeArrayKlass) {
> return calculateObjectArrayDumpRecordSize(oaOop);
> } else {
> // Internal object, nothing to write.
> return 0;
> }
> . . .
> protected void writeObjectArray(ObjArray array) throws IOException {
> int headerSize = getArrayHeaderSize(true);
> final int length = calculateArrayMaxLength(array.getLength(),
> headerSize,
> OBJ_ID_SIZE,
> "Object");
> out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP);
> writeObjectID(array);
> out.writeInt(DUMMY_STACK_TRACE_ID);
> out.writeInt(length);
> writeObjectID(array.getKlass().getJavaMirror());
> for (int index = 0; index < length; index++) {
> OopHandle handle = array.getOopHandleAt(index);
> writeObjectID(getAddressValue(handle));
> }
> }
I guess you copied the code from HeapHprofBinWriter.java, then it is tested
e.g. ClhsdbDumpheap.java.
However it does not work with flattened array now because heap dumper in SA
does not support it. Thus I will work for it in JDK-8381370 (patch is ready,
but it depends on this PR)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32849#discussion_r4226625609