agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java
Print this page
*** 40,49 ****
--- 40,51 ----
// Mirror class for HeapRegionSeq. It essentially encapsulates the G1HeapRegionTable.
public class HeapRegionSeq extends VMObject {
// G1HeapRegionTable _regions
static private long regionsFieldOffset;
+ // uint _allocated_lenght
+ static private CIntegerField allocatedLengthField;
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
initialize(VM.getVM().getTypeDataBase());
*** 53,62 ****
--- 55,65 ----
static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HeapRegionSeq");
regionsFieldOffset = type.getField("_regions").getOffset();
+ allocatedLengthField = type.getCIntegerField("_allocated_length");
}
private G1HeapRegionTable regions() {
Address regionsAddr = addr.addOffsetTo(regionsFieldOffset);
return (G1HeapRegionTable) VMObjectFactory.newObject(G1HeapRegionTable.class,
*** 65,76 ****
public long length() {
return regions().length();
}
public Iterator<HeapRegion> heapRegionIterator() {
! return regions().heapRegionIterator();
}
public HeapRegionSeq(Address addr) {
super(addr);
}
--- 68,83 ----
public long length() {
return regions().length();
}
+ public long allocatedLength() {
+ return allocatedLengthField.getValue(addr);
+ }
+
public Iterator<HeapRegion> heapRegionIterator() {
! return regions().heapRegionIterator(allocatedLength());
}
public HeapRegionSeq(Address addr) {
super(addr);
}