On Thu, 26 Mar 2026 21:11:13 GMT, Stefan Karlsson <[email protected]> wrote:
>> These functions cast oops to arrayOop without first checking that the `obj`
>> argument is an array. It turns out that TestIntrinsics.java sends in
>> non-array objects.
>>
>> I found this when I worked on something else and changed
>> `obj->is_null_free_array()` to `obj->klass()->is_null_free_array_klass()`,
>> and the latter asserted because `obj` was a String and not an array.
>
> Stefan Karlsson has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Change the functions to take an Object[] as the argument
That was a lot of effort but I think the signatures make more sense now.
I have concerns about the main jvm.cpp changes though.
src/hotspot/share/prims/jvm.cpp line 564:
> 562: Klass* klass = o->klass();
> 563:
> 564: return klass->is_flatArray_klass();
Given the definition:
#ifdef _LP64
bool oopDesc::is_flatArray() const {
markWord mrk = mark();
return (mrk.is_unlocked()) ? mrk.is_flat_array() :
klass()->is_flatArray_klass();
}
I think this needs to retain the original form and not call
`is_flatArray_klass` directly.
src/hotspot/share/prims/jvm.cpp line 573:
> 571: assert(klass->is_objArray_klass(), "Expects an object array");
> 572:
> 573: return klass->is_null_free_array_klass();
Ditto - this needs to call `oop->is_null_free_array`.
src/hotspot/share/prims/jvm.cpp line 590:
> 588: }
> 589:
> 590: if (klass->is_flatArray_klass()) {
Again `oop->is_flatArray`.
-------------
Changes requested by dholmes (Committer).
PR Review:
https://git.openjdk.org/valhalla/pull/2261#pullrequestreview-4017522345
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2261#discussion_r2997833716
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2261#discussion_r2998384854
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2261#discussion_r2998387411