Since default hash value of an object is the object address of the object, on 32-bit machine, it makes sense considering hash value is an int value. My question is that on 6
As far as I know and test, the most reliable way to get native address from JVM internal addess in case of compressed-oops mode, is using "getNarrowOopBase" and "getNarrowOopShift" methods of "sun.jvm.hotspot.memory.Universe" class and that class can be available in case of using "Java HotSpot Serviceability Agent".
Native address can be calculated as:
if (compressedRef) {
return (address >> compressRefShift) - compressRefBase;
}
else {
return address;
}
Here are usages of it
https://github.com/serkan-ozal/jillegal/blob/master/src/main/java/tr/com/serkanozal/jillegal/util/HotspotJvmInfoUtil.java
https://github.com/serkan-ozal/jillegal/blob/master/src/main/java/tr/com/serkanozal/jillegal/util/JvmUtil.java