Header Compression

Published on 2022-11-29.

Fitting two pointers into an 8-byte instance header:

+---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | +---------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+ ╰──────────────────────┬──────────────────────╯ ╰──────────────────────────────┬──────────────────────────────────────╯ ╰──┬──╯ 24 bits: vtable/type/klass pointer 36 bits: forwarding pointer 4 bits: other uses 128 byte granularity, 4GiB address space (type 7)¹ 8 byte granularity, 1TiB address space (type 4)²

¹: Pointer Compression Type 7
²: Pointer Compression Type 4