On Tue, 16 Dec 2025 12:52:18 GMT, Paul Hübner <[email protected]> wrote:

>> src/hotspot/share/oops/flatArrayKlass.hpp line 95:
>> 
>>> 93: 
>>> 94:   // sizing
>>> 95:   static int header_size()  { return sizeof(FlatArrayKlass) / wordSize; 
>>> }
>> 
>> Curiously enough we actually got this right for 
>> `RefArrayKlass::header_size()` and I'm guessing the following assertion 
>> didn't actually do anything meaningful:
>> 
>> assert(RefArrayKlass::header_size() <= InstanceKlass::header_size(),
>>          "array klasses must be same size as InstanceKlass");
>
> Maybe it could even make sense to tighten the `<=` into a `=`, going by the 
> error message. Thoughts?

I think the reason why the check is there is so that vtables start at the same 
offset in all Klasses. So, it really just wants to make sure that the array 
klasses are not so big that they start putting fields where the vtable is 
supposed to start. I think the comment can be tweaked a little bit here.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1804#discussion_r2623510191

Reply via email to