On Fri, 19 Jun 2026 14:16:57 GMT, Christian Hagedorn <[email protected]> wrote:
>> The provided test cases fail when inlining the `Array.copyOf/copyOfRange()` >> intrinsics where the source array is flat and from an abstract value class. >> >> The current code checks whether the source array or the destination array >> klass contain oops by assuming that a flat value class array is always >> concrete and thus an `InlineKlass` (i.e. can call `inline_klass()`). >> However, we could also have abstract value class arrays that are known to be >> flat (see test cases). This leads to a cast assertion failure because >> abstract value classes are represented by an `InstanceKlass` and not an >> `InlineKlass`. >> >> To fix this, I added a simple bailout when detecting an abstract flat value >> class array. This is a conservative correctness fix and should be revisited >> again post-Valhalla-integration. We have >> [JDK-8251971](https://bugs.openjdk.org/browse/JDK-8251971) in place for that >> which should also tackle other issues around the arraycopy intrinsics and >> also address performance problems. >> >> Thanks, >> Christian >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Christian Hagedorn has updated the pull request incrementally with one > additional commit since the last revision: > > fix tklass src/hotspot/share/opto/library_call.cpp line 5215: > 5213: (orig_t == nullptr || (!orig_t->is_not_flat() > && (!orig_t->is_flat() || orig_t->elem()->inline_klass()->contains_oops()))) > && > 5214: // Can dest array be flat and contain oops? > 5215: can_dest_be_value_class_array && > (!tklass->is_flat() || > tklass->is_aryklassptr()->elem()->is_instklassptr()->instance_klass()->as_inline_klass()->contains_oops()))); This should also check for `tklass->is_not_flat()` instead. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2569#discussion_r3443155265
