< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1HeapRegionTable.java

Print this page

        

@@ -35,11 +35,10 @@
 import sun.jvm.hotspot.runtime.VMObjectFactory;
 import sun.jvm.hotspot.types.AddressField;
 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.
 
 public class G1HeapRegionTable extends VMObject {
     // HeapRegion** _base;

@@ -134,13 +133,12 @@
     public G1HeapRegionTable(Address addr) {
         super(addr);
     }
 
     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);
     }
 }
< prev index next >