On Fri, 9 Oct 2026 04:32:22 GMT, Yasumasa Suenaga <[email protected]> wrote:
>> 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)
Okay then. I did not know about your plans to address this and provide needed
test coverage with the JDK-8381370.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32849#discussion_r4228962385