[lworld] RFR: 8329218: [lworld] Arrays.copyOf and Arrays.copyOfRange support for null-restricted arrays

Mandy Chung mchung at openjdk.org
Wed Apr 3 17:38:07 UTC 2024


On Wed, 3 Apr 2024 16:21:29 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> `Arrays::copyOf` and `Arrays::copyOfRange` should return a null-restricted array if the input array is null-restricted.   The intrinsification for these methods will need to be updated ([JDK-8329218](https://bugs.openjdk.org/browse/JDK-8329218)).  Three test cases in `test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestArrays.java` are commented out until JDK-8329218 is resolved.

I should clarify.  This change is to enable valhalla tests to continue to use `Arrays::copyOf` for null-restricted arrays.  It's solely implementation change.     lworld does not have the compiler and class file support for null-restricted types which is a separate JEP.   No public API for null-restricted arrays.

To create a null-restricted array, it has to use `jdk.internal.value.ValueClass::newNullRestrictedArray` and `CheckedType` and `NullRestrictedCheckedType` are internal APIs.   `System.arraycopy` should already work for null-restricted arrays.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1070#issuecomment-2035195991



More information about the valhalla-dev mailing list