Self attach fails on macOS / Eclipse Temurin

Aleksey Shipilev shade at redhat.com
Tue Oct 18 19:19:47 UTC 2022


On 10/18/22 20:14, Aleksey Shipilev wrote:
> I also see modern JDK reshuffled SA code a little bit, so current JOL fails there. I'll try to
> see if that code can be salvages somehow.
Seems doable!
   https://github.com/openjdk/jol/commit/2d958ff579c4fedfb906126dc4498dacb2dc2695

Please try to either build the fresh JOL from source, or pick the JAR here:
   https://builds.shipilev.net/jol/jol-cli-latest.jar

While there might still be MacOS-specific issues left, this works reliably on Linux with Temurin 
19+36 (note the absence of any additional options):

$ ~/Install/temurin-19+36/bin/java -jar jol-cli-latest.jar internals java.lang.String
# Running 64-bit HotSpot VM.
# Using compressed oop with 3-bit shift.
# Using compressed klass with 0x0000000800000000 base address and 0-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

Instantiated the sample instance via default constructor.

java.lang.String object internals:
OFF  SZ      TYPE DESCRIPTION               VALUE
   0   8           (object header: mark)     0x0000000000000001 (non-biasable; age: 0)
   8   4           (object header: class)    0x000089b8
  12   4       int String.hash               0
  16   1      byte String.coder              0
  17   1   boolean String.hashIsZero         false
  18   2           (alignment/padding gap)
  20   4    byte[] String.value              []
Instance size: 24 bytes
Space losses: 2 bytes internal + 0 bytes external = 2 bytes total


-- 
Thanks,
-Aleksey



More information about the jol-dev mailing list