< prev index next >

agent/src/share/classes/sun/jvm/hotspot/gc_implementation/shenandoah/ShenandoahHeap.java

Print this page
rev 10512 : [backport] Fixed SA due to code refactoring and merging

@@ -43,11 +43,10 @@
 public class ShenandoahHeap extends CollectedHeap {
     static private CIntegerField numRegions;
     static private JLongField    usedRegions;
     static private CIntegerField committedRegions;
     static private AddressField  regionsField;
-
     static {
         VM.registerVMInitializedObserver(new Observer() {
             public void update(Observable o, Object data) {
                 initialize(VM.getVM().getTypeDataBase());
             }

@@ -78,13 +77,13 @@
 
     public long committed() {
         return committedRegions.getValue(addr);
     }
     public void heapRegionIterate(SpaceClosure scl) {
-        ShenandoahHeapRegionSet regionSet = regions();
-        for (long index = 0; index < regionSet.activeRegions(); index ++) {
-            ShenandoahHeapRegion r = regionSet.getRegion(index);
+        int numRgns = (int)numRegions.getValue(addr);
+        for (int index = 0; index < numRgns; index ++) {
+            ShenandoahHeapRegion r = getRegion(index);
 
             // Walk live regions
             if (!r.isTrash() && !r.isUncommitted() && !r.isEmpty()) {
                 scl.doSpace(r);
             }

@@ -105,14 +104,14 @@
         tty.print("Shenandoah heap");
         tty.print(" [" + mr.start() + ", " + mr.end() + "]");
         tty.println(" region size " + ShenandoahHeapRegion.regionSizeBytes() / 1024 + " K");
     }
 
-    private ShenandoahHeapRegionSet regions() {
+    private ShenandoahHeapRegion getRegion(int index) {
         Address regsAddr = regionsField.getValue(addr);
-        return (ShenandoahHeapRegionSet) VMObjectFactory.newObject(ShenandoahHeapRegionSet.class,
-                regsAddr);
+        return (ShenandoahHeapRegion) VMObjectFactory.newObject(ShenandoahHeapRegion.class,
+                regsAddr.getAddressAt(index * VM.getVM().getAddressSize()));
     }
 
     public ShenandoahHeap(Address addr) {
         super(addr);
     }
< prev index next >