src/share/vm/gc_implementation/g1/heapRegion.cpp

Print this page
rev 6592 : [mq]: 8047818.reviews

@@ -1036,10 +1036,11 @@
 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
 // away eventually.
 
 void G1OffsetTableContigSpace::clear(bool mangle_space) {
   set_top(bottom());
+  set_saved_mark_word(bottom());
   CompactibleSpace::clear(mangle_space);
   _offsets.zero_bottom_entry();
   _offsets.initialize_threshold();
 }
 

@@ -1106,15 +1107,14 @@
   object_iterate(blk);
 }
 
 void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
   HeapWord* p = bottom();
-  if (!block_is_obj(p)) {
-    p += block_size(p);
-  }
   while (p < top()) {
+    if (block_is_obj(p)) {
     blk->do_object(oop(p));
+    }
     p += block_size(p);
   }
 }
 
 #define block_is_always_obj(q) true

@@ -1124,16 +1124,16 @@
 #undef block_is_always_obj
 
 G1OffsetTableContigSpace::
 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
                          MemRegion mr) :
-  _top(bottom()),
   _offsets(sharedOffsetArray, mr),
   _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
   _gc_time_stamp(0)
 {
   _offsets.set_space(this);
   // false ==> we'll do the clearing if there's clearing to be done.
   CompactibleSpace::initialize(mr, false, SpaceDecorator::Mangle);
+  _top = bottom();
   _offsets.zero_bottom_entry();
   _offsets.initialize_threshold();
 }