hotspot/src/share/vm/gc/shared/space.inline.hpp
changeset 37238 3d0a96116bff
parent 35862 411842d0c882
child 37495 7ef1f23dfc9c
--- a/hotspot/src/share/vm/gc/shared/space.inline.hpp	Sat Apr 02 05:39:25 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/space.inline.hpp	Fri Apr 01 10:16:31 2016 +0200
@@ -28,7 +28,6 @@
 #include "gc/serial/markSweep.inline.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/generation.hpp"
-#include "gc/shared/liveRange.hpp"
 #include "gc/shared/space.hpp"
 #include "gc/shared/spaceDecorator.hpp"
 #include "memory/universe.hpp"
@@ -117,9 +116,6 @@
   HeapWord*  end_of_live= q;            // One byte beyond the last byte of the last
                                         // live object.
   HeapWord*  first_dead = space->end(); // The first dead object.
-  LiveRange* liveRange  = NULL;         // The current live range, recorded in the
-                                        // first header of preceding free area.
-  space->_first_dead = first_dead;
 
   const intx interval = PrefetchScanIntervalInBytes;
 
@@ -158,16 +154,8 @@
 
       // otherwise, it really is a free region.
 
-      // for the previous LiveRange, record the end of the live objects.
-      if (liveRange) {
-        liveRange->set_end(q);
-      }
-
-      // record the current LiveRange object.
-      // liveRange->start() is overlaid on the mark word.
-      liveRange = (LiveRange*)q;
-      liveRange->set_start(end);
-      liveRange->set_end(end);
+      // q is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.
+      (*(HeapWord**)q) = end;
 
       // see if this is the first dead region.
       if (q < first_dead) {
@@ -180,9 +168,6 @@
   }
 
   assert(q == t, "just checking");
-  if (liveRange != NULL) {
-    liveRange->set_end(q);
-  }
   space->_end_of_live = end_of_live;
   if (end_of_live < first_dead) {
     first_dead = end_of_live;
@@ -227,9 +212,9 @@
     if (space->_first_dead == t) {
       q = t;
     } else {
-      // $$$ This is funky.  Using this to read the previously written
-      // LiveRange.  See also use below.
-      q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
+      // The first dead object is no longer an object. At that memory address,
+      // there is a pointer to the first live object that the previous phase found.
+      q = *((HeapWord**)(space->_first_dead));
     }
   }
 
@@ -247,11 +232,10 @@
       debug_only(prev_q = q);
       q += size;
     } else {
-      // q is not a live object, so its mark should point at the next
-      // live object
       debug_only(prev_q = q);
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();
-      assert(q > prev_q, "we should be moving forward through memory");
+      // q is not a live object, instead it points at the next live object
+      q = *(HeapWord**)q;
+      assert(q > prev_q, "we should be moving forward through memory, q: " PTR_FORMAT ", prev_q: " PTR_FORMAT, p2i(q), p2i(prev_q));
     }
   }