RFR: 7904124: JOL: Correct mark header size for Lilliput V2 in object internals

Oli Gillespie ogillespie at openjdk.org
Mon Dec 22 17:20:21 UTC 2025


Before (mark header size is wrong, overlapping the first field):

java.lang.String object internals:
OFF  SZ      TYPE DESCRIPTION               VALUE
  0   8           (object header: mark)     0x0036449200bc8001 (Lilliput)
  4   4       int String.hash               3556498


After:

java.lang.String object internals:
OFF  SZ      TYPE DESCRIPTION               VALUE
  0   4           (object header: mark)     0x00bc8001 (Lilliput)
  4   4       int String.hash               3556498


ModelVM naively uses the address size as the mark header size, but that's not valid for Lilliput V2. Use object header size minus class header size instead (both of these are implemented for Lilliput V2). I'm not certain if this is correct in all scenarios.

**Testing**: spot-checked with Lilliput off, Lilliput V1 and Lilliput V2 for String and a few other classes. Ran `mvn clean verify`.

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

Commit messages:
 - 7904124: JOL: Correct mark header size for Lilliput V2 in object internals

Changes: https://git.openjdk.org/jol/pull/66/files
  Webrev: https://webrevs.openjdk.org/?repo=jol&pr=66&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7904124
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jol/pull/66.diff
  Fetch: git fetch https://git.openjdk.org/jol.git pull/66/head:pull/66

PR: https://git.openjdk.org/jol/pull/66


More information about the jol-dev mailing list