-XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=16
Eugen Rabii
eugen.rabii at gmail.com
Mon Feb 15 13:48:25 UTC 2016
Hi,
This is probably not the best place to ask, but probably the only place
I can figure out where I might get a good answer.
So, I'm trying to run some simple code, jdk-8.
System.out.println(VMSupport.vmDetails());
Integer i = new Integer(23);
System.out.println(ClassLayout.parseInstance(i)
.toPrintable());
*The first attempt is to run it with compressed oops disabled and
compressed klass also on 64-bit JVM.
*-XX:-UseCompressedOops -XX:-UseCompressedClassPointers
The output, pretty much expected is :
Running 64-bit HotSpot VM.
Objects are 8 bytes aligned.
java.lang.Integer object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) 01 00 00 00
(00000001 00000000 00000000 00000000) (1)
4 4 (object header) 00 00 00 00
(00000000 00000000 00000000 00000000) (0)
8 4 (object header) 48 33 36 97
(01001000 00110011 00110110 10010111) (-1758055608)
12 4 (object header) 01 00 00 00
(00000001 00000000 00000000 00000000) (1)
16 4 int Integer.value 23
20 4 (loss due to the next object alignment)
Instance size: 24 bytes (reported by Instrumentation API)
Space losses: 0 bytes internal + 4 bytes external = 4 bytes total
That makes sense : 8 bytes klass word + 8 bytes mark word + 4 bytes for
the actual value and 4 for padding (to align on 8 bytes) = 24 bytes.
*
**The second attempt it to run it with **compressed oops enabled
compressed klass also on 64-bit JVM.
*Again, the output is pretty much understandable :
Running 64-bit HotSpot VM.
Using compressed oop with 3-bit shift.
Using compressed klass with 3-bit shift.
Objects are 8 bytes aligned.
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) 01 00 00 00
(00000001 00000000 00000000 00000000) (1)
4 4 (object header) 00 00 00 00
(00000000 00000000 00000000 00000000) (0)
8 4 (object header) f9 33 01 f8
(11111001 00110011 00000001 11111000) (-134138887)
12 4 int Dummy.i 42
Instance size: 16 bytes (reported by Instrumentation API).
4 bytes compressed oop (klass word) + 8 bytes mark word + 4 bytes for
the value + no space loss = 16 bytes.
The thing that does NOT make sense to me is this use-case:
*-XX:+UseCompressedOops -XX:+UseCompressedClassPointers
-XX:ObjectAlignmentInBytes=16
*The output is this:
Running 64-bit HotSpot VM.
Using compressed oop with 4-bit shift.
Using compressed klass with 0x0000001000000000 base address and 0-bit shift.
I was really expecting to both be "4-bit shift". Why they are not?
Thank you,
Eugene.
*
*
More information about the jol-dev
mailing list