8189069: regression after push of 8187403: "AssertionFailure: addr should be OopHandle"

Reviewed-by: sspitsyn, jgeorge
This commit is contained in:
Yasumasa Suenaga 2017-10-11 23:29:24 +09:00
parent d3466f7dce
commit ccbf029d2b
2 changed files with 6 additions and 13 deletions

View File

@ -37,7 +37,6 @@ 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.
@ -136,11 +135,10 @@ public class G1HeapRegionTable extends VMObject {
}
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);
}
}

View File

@ -38,7 +38,6 @@ 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 HeapRegion. Currently we don't actually include
// any of its fields but only iterate over it.
@ -76,12 +75,8 @@ public class HeapRegion extends CompactibleSpace {
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);
}