How to detect if the VM is running with compact refs from within the VM (no agent)?

Krystal Mok rednaxelafx at
Wed Mar 14 11:13:04 PDT 2012

Couldn't find these two fields in sun.misc.Unsafe (in JDK6u30), found
arrayIndexScale(Class) and addressSize() methods instead.
Works as advertised. Thanks John! Learning new bits everday for me, too :-)

- Kris

On Thu, Mar 15, 2012 at 1:53 AM, John Rose <john.r.rose at> wrote:

> On Mar 14, 2012, at 1:41 AM, Krystal Mok wrote:
> I'm not aware of any way to get the exact "reference size" (or "oop size"
> in HotSpot's terms). But it's possible to know whether compressed oops is
> in use or not.
> For some platforms, you could inspect
> sun.misc.Unsafe.ARRAY_OBJECT_INDEX_SCALE (= oopSize) and ADDRESS_SIZE (=
> wordSize).
> — John
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list