On Wed, 3 Sep 2025 20:36:42 GMT, Chen Liang <[email protected]> wrote:
>> src/hotspot/share/cds/dynamicArchive.cpp line 371:
>>
>>> 369: if (oak->is_refined_objArray_klass()) {
>>> 370: oak = ObjArrayKlass::cast(oak->super());
>>> 371: }
>>
>> Why is this needed?
>
> I think this is probably to convert specialize array klasses to the
> ObjArrayKlass that map 1-1 to Java's classes.
We don't want to archive refined array klasses in the dynamic archive, that's
why this code ensures we only hold onto the ObjArrayKlass. Without this, the
static archive can hold some dimensions of the array klass while the dynamic
archive can have others.
The method `setup_array_klasses` tries to link together these different
dimensions but we run into some trouble because we have the ObjArrayKlass and
the different flavors of refined array klasses. It's better to just avoid
putting array klasses in the dynamic archive altogether.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/1452#discussion_r2322609691