[lworld] RFR: 8366705: [lworld] Re-work of arrays meta-data [v3]
Chen Liang
liach at openjdk.org
Wed Sep 3 02:43:03 UTC 2025
On Tue, 2 Sep 2025 17:49:28 GMT, Frederic Parain <fparain at openjdk.org> wrote:
>> Since the removal of Q-types and the notion that nullability was not part of the Java type, there was an awkward situation because nullable arrays of value types and null free arrays of value types had each a different Java mirror when they were in fact supposed to have the same Java type.
>> In order to accommodate to the new situation, that arrays can have properties (nullability, flatness, atomicity, etc.) that are not part of their Java type, the 1-1 relationship between the *ArrayKlass and the Java mirror must be broken.
>> The proposed solution is to dedicate one instance of ObjArrayKlass to represent the Java type of the array in the JVM, and have this instance being the counterpart of the Java mirror of the array, and have several instances of RefArrayKlass and FlatArrayKlass that represent the refinements of the Java array type. Each RefArrayKlass/FlatArrayKlass encodes the characteristic of a Java array for a given element type and a set of properties.
>
> Frederic Parain has updated the pull request incrementally with one additional commit since the last revision:
>
> Forgot a TODO
src/hotspot/share/cds/archiveBuilder.cpp line 827:
> 825: num_obj_array_klasses ++;
> 826: type = "ref array";
> 827: } else if (k->is_objArray_klass()) {
Is this redundant? I think flat arrays union ref arrays = obj arrays?
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()`.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1452#discussion_r2317612466
PR Review Comment: https://git.openjdk.org/valhalla/pull/1452#discussion_r2317611161
More information about the valhalla-dev
mailing list