RFR: CODETOOLS-7903119: JOL: Experimental support for Lilliput

Aleksey Shipilev shade at openjdk.java.net
Tue Mar 8 09:45:30 UTC 2022


Project Lilliput aims to reduce the size of the object header. JOL can support that project by detecting the Lilliput VM and printing out object internals more precisely. 

Sample output on JDK 19+:


# Running 64-bit HotSpot VM.
# Using compressed oop with 3-bit shift.
# Using compressed klass with 3-bit shift.
# Objects are 8 bytes aligned.
#                       ref, bool, byte, char, shrt,  int,  flt,  lng,  dbl
# Field sizes:            4,    1,    1,    2,    2,    4,    4,    8,    8
# Array element sizes:    4,    1,    1,    2,    2,    4,    4,    8,    8
# Array base offsets:    16,   16,   16,   16,   16,   16,   16,   16,   16

[B object internals:
OFF  SZ   TYPE DESCRIPTION               VALUE
  0   8        (object header: mark)     0x0000000000000001 (non-biasable; age: 0)
  8   4        (object header: class)    0x00001ea0
 12   4        (array length)            5
 16   5   byte [B.<elements>             N/A
 21   3        (object alignment gap)    
Instance size: 24 bytes
Space losses: 0 bytes internal + 3 bytes external = 3 bytes total


Sample output on current Lilliput:


# Running 64-bit HotSpot VM.
# Lilliput VM detected (experimental).
# Using compressed oop with 3-bit shift.
# Using compressed klass with 3-bit shift.
# Objects are 8 bytes aligned.
#                       ref, bool, byte, char, shrt,  int,  flt,  lng,  dbl
# Field sizes:            4,    1,    1,    2,    2,    4,    4,    8,    8
# Array element sizes:    4,    1,    1,    2,    2,    4,    4,    8,    8
# Array base offsets:    16,   16,   16,   16,   16,   16,   16,   16,   16

[B object internals:
OFF  SZ   TYPE DESCRIPTION               VALUE
  0   8        (object header: mark)     0x0000001200000001 (Lilliput)
  8   4        (array length)            4
 12   4        (alignment/padding gap)   
 16   4   byte [B.<elements>             N/A
 20   4        (object alignment gap)    
Instance size: 24 bytes
Space losses: 4 bytes internal + 4 bytes external = 8 bytes total


Sample run on Lilliput + https://github.com/openjdk/lilliput/pull/41:


# Running 64-bit HotSpot VM.
# Lilliput VM detected (experimental).
# Using compressed oop with 3-bit shift.
# Using compressed klass with 3-bit shift.
# Objects are 8 bytes aligned.
#                       ref, bool, byte, char, shrt,  int,  flt,  lng,  dbl
# Field sizes:            4,    1,    1,    2,    2,    4,    4,    8,    8
# Array element sizes:    4,    1,    1,    2,    2,    4,    4,    8,    8
# Array base offsets:    12,   12,   12,   12,   12,   12,   12,   16,   16

[B object internals:
OFF  SZ   TYPE DESCRIPTION               VALUE
  0   8        (object header: mark)     0x0000001200000001 (Lilliput)
  8   4        (array length)            4
 12   4   byte [B.<elements>             N/A
Instance size: 16 bytes
Space losses: 0 bytes internal + 0 bytes external = 0 bytes total

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

Commit messages:
 - Support Lilliput

Changes: https://git.openjdk.java.net/jol/pull/22/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jol&pr=22&range=00
  Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7903119
  Stats: 73 lines in 3 files changed: 66 ins; 0 del; 7 mod
  Patch: https://git.openjdk.java.net/jol/pull/22.diff
  Fetch: git fetch https://git.openjdk.java.net/jol pull/22/head:pull/22

PR: https://git.openjdk.java.net/jol/pull/22


More information about the jol-dev mailing list