RFR: CODETOOLS-7903075: JOL: Incorrect ClassLayout header/loss calculation for arrays

Thomas Stuefe stuefe at openjdk.java.net
Fri Dec 10 16:47:27 UTC 2021


On Fri, 10 Dec 2021 16:09:23 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> See the bug report.

Don't know the code but seems fine. Patch works, alignment gap is correctly shown and accounted:


3-byte array, compressed class pointers on:

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


3-byte array, compressed class pointers off:


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

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

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


More information about the jol-dev mailing list