[lworld] Integrated: 8373787: [lworld] InstanceKlass::size mixes bytes and words
Stefan Karlsson
stefank at openjdk.org
Tue Dec 16 17:13:14 UTC 2025
On Tue, 16 Dec 2025 12:26:42 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> The following function in `InstanceKlass` is supposed to return size in words:
>
> static int size(int vtable_length, int itable_length,
> int nonstatic_oop_map_size,
> bool is_interface,
> bool is_inline_type) {
> return align_metadata_size(header_size() +
> vtable_length +
> itable_length +
> nonstatic_oop_map_size +
> (is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
> (is_inline_type ? (int)sizeof(InlineKlassFixedBlock) : 0));
> }
>
> but `sizeof(InlineKlassFixedBlock)` returns a size in bytes. This adds 640 bytes instead of 80 bytes to all InlineKlasses.
>
> This can be seen by running `jcmd <pid> VM.classes` to check the size of the InlineKlass of Integer before and after the fix for this:
>
> Before:
>
> 0x00000ffc0024d260 167 fully_initialized WS java.lang.Integer
>
> After:
>
> 0x000001800024d260 97 fully_initialized WS java.lang.Integer
>
>
> That is in words. So this bug added an extra `(167 - 97) * 8 == 560` bytes.
>
> I've so far only done some local smoke testing with TEST=hotspot_valhalla
This pull request has now been integrated.
Changeset: e82573ea
Author: Stefan Karlsson <stefank at openjdk.org>
Committer: Paul Hübner <phubner at openjdk.org>
URL: https://git.openjdk.org/valhalla/commit/e82573ea7cc59d92aa57f17674e4e52ffd619751
Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod
8373787: [lworld] InstanceKlass::size mixes bytes and words
Reviewed-by: phubner, fparain
-------------
PR: https://git.openjdk.org/valhalla/pull/1804
More information about the valhalla-dev
mailing list