On Thu, 12 Feb 2026 19:49:48 GMT, Matias Saavedra Silva <[email protected]> 
wrote:

> Different array layouts result in distinct array klass metadata which are 
> stored in a linked list with the base ObjArrayKlass acting as the head. 
> Multiple layouts are currently uncommon, so this assert was sufficient:
> 
> `assert(objarray_k == k || objarray_k->next_refined_array_klass() == k) 
> failed: must be`
> 
> This assert is not correct since `k` could refer to another refined array 
> klass further down the linked list. This patch corrects this assert by adding 
> a find method to iterate through the linked list in case there are multiple 
> layouts for the same type. A new test was added to catch this failure. 
> Verified with tier 1-5 tests.

The changes look good, just a small sanity question from my end. Thanks for 
fixing this!

src/hotspot/share/oops/objArrayKlass.cpp line 448:

> 446:       return true;
> 447:     }
> 448:     curr = curr->next_refined_array_klass();

I suppose that we can't get into a situation where somebody is trying to create 
an array of this klass since we're still restoring, right? I'm bringing this up 
because we usually have to take a lock before iterating through the linked 
list, cf. `ObjArrayKlass::klass_with_properties`.

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

PR Review: 
https://git.openjdk.org/valhalla/pull/2095#pullrequestreview-3795839670
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2095#discussion_r2803014982

Reply via email to