On Thu, 7 May 2026 11:33:11 GMT, Tobias Hartmann <[email protected]> wrote:

>> https://github.com/openjdk/valhalla/pull/2390 triggered some weird failures 
>> and it turned out that this invariant is broken when 
>> `ValueClass.newReferenceArray` is called before the default refined klass is 
>> created:
>> https://github.com/openjdk/valhalla/blob/7558cd73f557e34b0f11dd0a37952854ab2881f6/src/hotspot/share/oops/objArrayKlass.cpp#L410-L414
>> 
>> In that case, the first entry in the linked list will not be the default 
>> refined klass but the not-flat, nullable variant. This leads to the code 
>> emitted by `LibraryCallKit::load_default_refined_array_klass` returning the 
>> wrong refined klass and thus to wrong results with the `_copyOf` and 
>> `_newArray` intrinsics.
>> 
>> I added a targeted regression test for this that covers both intrinsics and 
>> randomizes the order in which refined klasses are created.
>> 
>> The fix was provided by @fparain.
>> 
>> Thanks,
>> Tobias
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Tobias Hartmann has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   More asserts

Thanks Fred! The test still triggers an intermittent issue that I'm 
investigating and I'll therefore hold off with integration until I found the 
root cause.

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

PR Comment: https://git.openjdk.org/valhalla/pull/2406#issuecomment-4397029855

Reply via email to