On Wed, 19 Aug 2026 14:47:02 GMT, Johan Sjölen <[email protected]> wrote:

>> When creating a new array of type T, the type T should not be initialized. 
>> This is the case for all types (classes and value classes). The reason that 
>> this code was added is probably because in a previous Valhalla model, the VM 
>> filled in a default value for each flattened array element, which 
>> necessitated the initialization of the class.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Johan Sjölen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   No lib + document

src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 317:

> 315: 
> 316:     /**
> 317:      * Returns an array compatible with the requested layout layout kind.

Suggestion:

     * Returns an array compatible with the requested layout kind.

src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 318:

> 316:     /**
> 317:      * Returns an array compatible with the requested layout layout kind.
> 318:      * The returned array does not necessarily contain initialized data.

What does "not necessarily" mean here? What controls/affects whether or not the 
array elements are (default?) initialized?

src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 323:

> 321:      * @param length length of the array
> 322:      * @param layoutKind opaque value describing the requested layout of 
> the array's content
> 323:      * @return an array whose contents is potentially uninitialized

Similarly what does "potentially uninitialized" mean here? And isn't the key 
feature of the returned array that it conforms to the requested layout? That 
should be mentioned here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32193#discussion_r3818012202
PR Review Comment: https://git.openjdk.org/jdk/pull/32193#discussion_r3818023446
PR Review Comment: https://git.openjdk.org/jdk/pull/32193#discussion_r3818026870

Reply via email to