On Wed, 3 Sep 2025 02:37:55 GMT, Chen Liang <[email protected]> wrote:

>> Frederic Parain has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Forgot a TODO
>
> src/hotspot/share/cds/cdsEnumKlass.cpp line 92:
> 
>> 90:   }
>> 91:   oop oop_field = mirror->obj_field(fd.offset());
>> 92:   Klass* oop_field_klass = oop_field->is_objArray() ? 
>> oop_field->klass()->super() : oop_field->klass();
> 
> Hmm, what does this do? I assume `is_objArray` tests if something can be 
> converted to Java `Object[]`. In this case, CDS should check if the component 
> type of the array instead of the array supepr class, I think? The original 
> code did not call `super()`.

There should be no oops that are ObjArrayKlass, so in reality this is checking 
for refined array klasses. The reason it goes up to the super is that the super 
will be an ObjArrayKlass, specifically the same one that will be returned by 
`ik->array_klass_or_null()`. 

I think you're right in saying that we can look at the element klass (or bottom 
klass?) and do the comparison as well.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1452#discussion_r2325533312

Reply via email to