On Tue, 16 Dec 2025 14:26:05 GMT, Stefan Karlsson <[email protected]> wrote:
>> 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.
It is even weirder when you consider that the
RefArrayKlass/FlatArrayKlass::header_size() value is only used for assertion.
All paths I've found using this method end up calling
`ArrayKlass::static_size()`, where the header size value is asserted, then
immediately erased:
int ArrayKlass::static_size(int header_size) {
// size of an array klass object
assert(header_size <= InstanceKlass::header_size(), "bad header size");
// If this assert fails, see comments in base_create_array_klass.
header_size = InstanceKlass::header_size();
int vtable_len = Universe::base_vtable_size();
int size = header_size + vtable_len;
return align_metadata_size(size);
}
Could we have a more static way to check this header size constraint?
This could be the topic of another CR.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/1804#discussion_r2623531226