Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 2.29 KB

File metadata and controls

57 lines (43 loc) · 2.29 KB

Does JOL report the real object layout

JOL 0.17 against the VM's own -XX:+PrintFieldLayout, both read out of the same JVM in the same run. 96 class comparisons across 1 platform: linux-x64.

JOL and the VM agreed on every field of every class except java.lang.String.

linux-x64

OpenJDK 64-Bit Server VM (fastdebug build 27-internal-adhoc.root.jdk-src, mixed mode), built from 815ff4dc327f.

configuration UseCompactObjectHeaders UseCompressedOops attach JOL header classes agreeing
default true true attach allowed 8 11 of 12
default true true attach refused 8 11 of 12
no_compact_headers false true attach allowed 12 11 of 12
no_compact_headers false true attach refused 12 11 of 12
no_compressed_oops true false attach allowed 8 11 of 12
no_compressed_oops true false attach refused 8 11 of 12
heap_above_32g true false attach allowed 8 11 of 12
heap_above_32g true false attach refused 8 11 of 12

Where they disagree: java.lang.String on linux-x64

  • parseClass has no field flags
  • parseInstance has no field flags
field VM says JOL says
coder 12 12
flags 14 absent
hash 8 8
hashIsZero 13 13
value 16 16

Instance size: VM 24, JOL 24.

What JOL says about itself

JOL prints this before it prints a layout, in every configuration measured:

# VM mode: 64 bits
# Lilliput VM detected (experimental)
# Compressed references (oops): 3-bit shift
# Compressed class pointers: 3-bit shift
# WARNING | Compressed references base/shifts are guessed by the experiment!
# WARNING | Therefore, computed addresses are just guesses, and ARE NOT RELIABLE.
# WARNING | Make sure to attach Serviceability Agent to get the reliable addresses.
# Object alignment: 8 bytes
# 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