On Thu, 7 May 2026 07:49:22 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). This pull request has now been integrated. Changeset: cadae12d Author: Tobias Hartmann <[email protected]> URL: https://git.openjdk.org/valhalla/commit/cadae12d0021cab7f8f2e02f66b22ebf1fd1976b Stats: 261 lines in 6 files changed: 203 ins; 34 del; 24 mod 8384052: [lworld] Default refined klass invariant in ObjArrayKlass::klass_from_description is broken Co-authored-by: Frederic Parain <[email protected]> Reviewed-by: fparain ------------- PR: https://git.openjdk.org/valhalla/pull/2406
