On Thu, 8 Oct 2026 08:16:06 GMT, Serguei Spitsyn <[email protected]> wrote:
>> Yasumasa Suenaga has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Fix
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/FlatArray.java line
> 37:
>
>> 35: // A FlatArray is an array containing flattened value objects.
>> 36:
>> 37: public class FlatArray extends ObjArray {
>
> Q: Changing the inherited class from `Array` to `ObjArray` is suspisious.
> The following methods may need overriding: `isObjArray()`,
> `getOopHandleAt()`, and `getObjAt()`.
> Also, you may need to check `instanceof ObjArray` use-sites to correctly
> handle `FlatArray` cases:
>
> public Object readObject(Oop oop) throws ClassNotFoundException {
> . . .
> } else if (oop instanceof ObjArray){
> return readObjectArray((ObjArray)oop);
> } else {
> return null;
> }
> }
> . . .
> public boolean doObj(Oop oop) {
> try {
>
> writeHeapRecordPrologue(calculateOopDumpRecordSize(oop));
> if (oop instanceof TypeArray) {
> writePrimitiveArray((TypeArray)oop);
> } else if (oop instanceof ObjArray) {
> Klass klass = oop.getKlass();
> ObjArrayKlass oak = (ObjArrayKlass) klass;
> Klass bottomType = oak.getBottomKlass();
> if (bottomType instanceof InstanceKlass ||
> bottomType instanceof TypeArrayKlass) {
> writeObjectArray((ObjArray)oop);
> } else {
> writeInternalObject(oop);
> }
> . . .
> if (oop instanceof Instance || oop instanceof TypeArray) {
> return true;
> } else if (oop instanceof ObjArray) {
> ObjArrayKlass oak = (ObjArrayKlass) oop.getKlass();
> Klass bottomKlass = oak.getBottomKlass();
> return bottomKlass instanceof InstanceKlass ||
> bottomKlass instanceof TypeArrayKlass;
> } else {
> return false;
> }
> }
> . . .
> 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...
Also, do we have a test coverage for the cases above? It is worth to
double-check.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32849#discussion_r4216913689