[lworld] RFR: 8366705: [lworld] Re-work of arrays meta-data

Coleen Phillimore coleenp at openjdk.org
Tue Sep 2 16:44:58 UTC 2025


On Fri, 9 May 2025 19:13:50 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.

Makes sense - found a typo.  Are you going to check this in with UseNewCode2 or you could add a global flag for this because I think you're going to need a new one?

src/hotspot/share/oops/refArrayKlass.hpp line 33:

> 31: class ClassLoaderData;
> 32: 
> 33: // RefjArrayKlass is the klass for arrays of references

you have an extra j in this.

src/hotspot/share/oops/refArrayKlass.hpp line 45:

> 43: 	 // Constructor
> 44: 	 RefArrayKlass(int n, Klass *element_klass, Symbol *name, bool null_free);
> 45: 	 static RefArrayKlass *allocate(ClassLoaderData *loader_data, int n, Klass *k, Symbol *name, bool null_free, TRAPS);

The stars go with the types, ie ClassLoaderData* loader_data.

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

PR Review: https://git.openjdk.org/valhalla/pull/1452#pullrequestreview-2829768901
PR Review Comment: https://git.openjdk.org/valhalla/pull/1452#discussion_r2082556067
PR Review Comment: https://git.openjdk.org/valhalla/pull/1452#discussion_r2082556373


More information about the valhalla-dev mailing list