--- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1HeapRegionTable.java 2017-10-10 10:57:59.758973115 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1HeapRegionTable.java 2017-10-10 10:57:59.587969500 +0900 @@ -37,7 +37,6 @@ import sun.jvm.hotspot.types.CIntegerField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; -import sun.jvm.hotspot.utilities.Assert; // Mirror class for G1HeapRegionTable. It's essentially an index -> HeapRegion map. @@ -136,11 +135,10 @@ } public HeapRegion getByAddress(Address addr) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(addr instanceof OopHandle, "addr should be OopHandle"); - } - long biasedIndex = addr.asLongValue() >>> shiftBy(); - return new HeapRegion(addr.addOffsetToAsOopHandle(biasedIndex * HeapRegion.getPointerSize())); + long offset = biasedIndex * HeapRegion.getPointerSize(); + Address result = (addr instanceof OopHandle) ? addr.addOffsetToAsOopHandle(offset) + : addr.addOffsetTo(offset); + return new HeapRegion(result); } } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java 2017-10-10 10:58:00.121980789 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java 2017-10-10 10:57:59.965977491 +0900 @@ -38,7 +38,6 @@ import sun.jvm.hotspot.types.CIntegerField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; -import sun.jvm.hotspot.utilities.Assert; // Mirror class for HeapRegion. Currently we don't actually include // any of its fields but only iterate over it. @@ -76,12 +75,8 @@ public HeapRegion(Address addr) { super(addr); - - if (Assert.ASSERTS_ENABLED) { - Assert.that(addr instanceof OopHandle, "addr should be OopHandle"); - } - - Address typeAddr = addr.addOffsetToAsOopHandle(typeFieldOffset); + Address typeAddr = (addr instanceof OopHandle) ? addr.addOffsetToAsOopHandle(typeFieldOffset) + : addr.addOffsetTo(typeFieldOffset); type = (HeapRegionType)VMObjectFactory.newObject(HeapRegionType.class, typeAddr); }