JEP draft: [Lilliput] Remove mark word from objects
| Owner | John Rose |
| Type | Feature |
| Scope | JDK |
| Status | Closed / Withdrawn |
| Component | hotspot / runtime |
| Duplicates | JEP 450: Compact Object Headers (Experimental) |
| Created | 2018/02/17 03:34 |
| Updated | 2023/04/17 18:22 |
| Issue | 8198331 |
Investigate downsizing average object size by removing (or downsizing) the mark word from the oopDesc layout.
DRAFT DRAFT DRAFT
The 64-bit mark word can be used for several purposes:
- GC state during a GC, such as a forwarding pointer
- lock state (not during a GC), including unlocked, thin-locked, biased, and inflated monitor
- object annotations by GC (a few "age" bits)
- storage for the
System.identityHashCode - a tag to distinguish object instances from value instances
There are well-known alternative representations for all of these mechanisms which do not use the 64-bit object header.
For example:
- GC state can be stored in a side array
- lock state can be stored in a side array and/or in a word preceding the object
- age annotations and "value tags" can be inserted into other "waste" space of the object, such as the high bits of the klass field (if it is present)
- hash codes can be stored in a word before the object, and/or be derived from the object's address in new-space
If we could remove mark words from all objects, the density of the heap would go up by a significant factor, basically (1+8/S), where S is the average object size; since S is typically something like 30-50 bytes (including arrays, which may be quite large), the overhead of mark words can often be a double-digit percentage.