提交 fc895a4c 编写于 作者: S sjohanss

8029329: tmtools tests fail with NPE (in the tool) when run with G1 and FlightRecorder

Summary: Now iterating over all committed (used) G1 regions instead of all reserved.
Reviewed-by: brutisso, dsamersoff, mgerdin
上级 d02acec9
...@@ -103,14 +103,14 @@ public class G1HeapRegionTable extends VMObject { ...@@ -103,14 +103,14 @@ public class G1HeapRegionTable extends VMObject {
@Override @Override
public void remove() { /* not supported */ } public void remove() { /* not supported */ }
HeapRegionIterator(Address addr) { HeapRegionIterator(long committedLength) {
index = 0; index = 0;
length = length(); length = committedLength;
} }
} }
public Iterator<HeapRegion> heapRegionIterator() { public Iterator<HeapRegion> heapRegionIterator(long committedLength) {
return new HeapRegionIterator(addr); return new HeapRegionIterator(committedLength);
} }
public G1HeapRegionTable(Address addr) { public G1HeapRegionTable(Address addr) {
......
...@@ -42,6 +42,8 @@ import sun.jvm.hotspot.types.TypeDataBase; ...@@ -42,6 +42,8 @@ import sun.jvm.hotspot.types.TypeDataBase;
public class HeapRegionSeq extends VMObject { public class HeapRegionSeq extends VMObject {
// G1HeapRegionTable _regions // G1HeapRegionTable _regions
static private long regionsFieldOffset; static private long regionsFieldOffset;
// uint _committed_length
static private CIntegerField committedLengthField;
static { static {
VM.registerVMInitializedObserver(new Observer() { VM.registerVMInitializedObserver(new Observer() {
...@@ -55,6 +57,7 @@ public class HeapRegionSeq extends VMObject { ...@@ -55,6 +57,7 @@ public class HeapRegionSeq extends VMObject {
Type type = db.lookupType("HeapRegionSeq"); Type type = db.lookupType("HeapRegionSeq");
regionsFieldOffset = type.getField("_regions").getOffset(); regionsFieldOffset = type.getField("_regions").getOffset();
committedLengthField = type.getCIntegerField("_committed_length");
} }
private G1HeapRegionTable regions() { private G1HeapRegionTable regions() {
...@@ -67,8 +70,12 @@ public class HeapRegionSeq extends VMObject { ...@@ -67,8 +70,12 @@ public class HeapRegionSeq extends VMObject {
return regions().length(); return regions().length();
} }
public long committedLength() {
return committedLengthField.getValue(addr);
}
public Iterator<HeapRegion> heapRegionIterator() { public Iterator<HeapRegion> heapRegionIterator() {
return regions().heapRegionIterator(); return regions().heapRegionIterator(committedLength());
} }
public HeapRegionSeq(Address addr) { public HeapRegionSeq(Address addr) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册