On Fri, 13 Mar 2026 07:57:51 GMT, Axel Boldt-Christmas <[email protected]> 
wrote:

>> Stefan Karlsson has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - Merge remote-tracking branch 'valhalla/lworld' into 
>> lworld_array_klass_cleanups
>>  - Update assert in CollectedHeap::array_allocate
>>  - Merge remote-tracking branch 'valhalla/lworld' into 
>> lworld_array_klass_cleanups
>>  - faKlass => fak
>>  - Stray whitespaces
>>  - Restore jniCheck.cpp
>>  - Array cleanups
>>  - Retype _objectArrayKlass
>>  - allocate_instance
>>  - Small cleanups
>>  - ... and 4 more: 
>> https://git.openjdk.org/valhalla/compare/db5c1873...531d7d01
>
> src/hotspot/share/memory/oopFactory.cpp line 144:
> 
>> 142: 
>> 143:   ArrayKlass* ak = klass->array_klass(CHECK_NULL);
>> 144:   ObjArrayKlass* oak = 
>> ObjArrayKlass::cast(ak)->klass_with_properties(props, CHECK_NULL);
> 
> Potential follow-up. 
> 
> Evaluate changing the `Klass::array_klass` interface to return an 
> `ObjArrayKlass*`, AFAIK we never get `TypeArrayKlass*` this way as we do not 
> have `Klass*` for primitives.

I tested it out and it didn't work all the way. It all falls on this piece of 
code:

ObjArrayKlass* ArrayKlass::array_klass(int n, TRAPS) {

  assert(dimension() <= n, "check order of chain");
  int dim = dimension();
  if (dim == n) return this;


Where the returned `this` could be a `TypeArrayKlass`.

While hitting this issue, I have a vague collection of having already done this 
experiment and hit the same issue.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2207#discussion_r2930245704

Reply via email to