On Thu, 7 May 2026 08:46:50 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: > > -XX:+UnlockDiagnosticVMOptions src/hotspot/share/opto/subnode.cpp line 1639: > 1637: if( !cmp->is_Sub() ) return nullptr; > 1638: int cop = cmp->Opcode(); > 1639: if (cop == Op_FastLock || cop == Op_FastUnlock || cop == > Op_FlatArrayCheck || Unrelated fix for an issue I hit during debugging. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2406#discussion_r3200096893
