8225801: Shenandoah: Adjust SA to reflect recent forwarding pointer changes
authorzgu
Fri, 14 Jun 2019 12:08:55 -0400
changeset 55413 22ce9e266a4b
parent 55412 55a79ffab804
child 55414 666f51a72171
8225801: Shenandoah: Adjust SA to reflect recent forwarding pointer changes Reviewed-by: shade
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java	Sat Jun 15 14:39:04 2019 +0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java	Fri Jun 14 12:08:55 2019 -0400
@@ -48,7 +48,6 @@
     static private CIntegerField logMinObjAlignmentInBytes;
 
     static private long regionPtrFieldSize;
-    static private long brookPtrSize;
     static {
         VM.registerVMInitializedObserver(new Observer() {
             public void update(Observable o, Object data) {
@@ -65,7 +64,6 @@
         regions = type.getAddressField("_regions");
         logMinObjAlignmentInBytes = type.getCIntegerField("_log_min_obj_alignment_in_bytes");
 
-        brookPtrSize = db.lookupIntConstant("HeapWordSize").longValue();
         Type regionPtrType = db.lookupType("ShenandoahHeapRegion*");
         regionPtrFieldSize = regionPtrType.getSize();
     }
@@ -75,11 +73,6 @@
     }
 
     @Override
-    public long oopOffset() {
-        return brookPtrSize;
-    }
-
-    @Override
     public CollectedHeapName kind() {
         return CollectedHeapName.SHENANDOAH;
     }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java	Sat Jun 15 14:39:04 2019 +0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java	Fri Jun 14 12:08:55 2019 -0400
@@ -184,10 +184,10 @@
                 if (regionStart == null) {
                     regionStart = start;
                 } else {
-                    regionEnd = start.addOffsetTo(heap.oopOffset() + size);
+                    regionEnd = start.addOffsetTo(size);
                 }
             }
-            start = start.addOffsetTo(heap.oopOffset() + size);
+            start = start.addOffsetTo(size);
         }
 
         if (regionStart != null) {
@@ -201,15 +201,13 @@
     }
 
     private boolean hasForwardee(Address rawPtr) {
-        // Use Mark as a helper to read forward pointer value.
+        // Forwarding pointer is stored in mark word when it is flagged "marked"
         Mark mark = new Mark(rawPtr);
-        Address forwardee = mark.valueAsAddress();
-        return (forwardee != rawPtr.addOffsetTo(heap.oopOffset()));
+        return mark.isMarked();
     }
 
     private long getObjectSize(Address rawPtr) {
-        // Dealing with a raw pointer, offsets forward pointer to find real Oop.
-        OopHandle handle = rawPtr.addOffsetToAsOopHandle(heap.oopOffset());
+        OopHandle handle = rawPtr.addOffsetToAsOopHandle(0);
         Oop obj = null;
 
         try {