< prev index next >

src/share/vm/gc/shared/space.inline.hpp

Print this page

        

@@ -26,11 +26,10 @@
 #define SHARE_VM_GC_SHARED_SPACE_INLINE_HPP
 
 #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"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/safepoint.hpp"

@@ -115,13 +114,10 @@
   HeapWord* t = space->scan_limit();
 
   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;
 
   while (q < t) {
     assert(!space->scanned_block_is_obj(q) ||

@@ -156,20 +152,12 @@
         }
       }
 
       // 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) {
         first_dead = q;
       }

@@ -178,13 +166,10 @@
       q = end;
     }
   }
 
   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;
   }
   space->_first_dead = first_dead;

@@ -225,13 +210,12 @@
     }
 
     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 should contain a pointer to the first live object
+      q = *((HeapWord**)(space->_first_dead));
     }
   }
 
   const intx interval = PrefetchScanIntervalInBytes;
 

@@ -245,15 +229,14 @@
       size_t size = MarkSweep::adjust_pointers(oop(q));
       size = space->adjust_obj_size(size);
       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));
     }
   }
 
   assert(q == t, "just checking");
 }
< prev index next >