< prev index next >

src/hotspot/share/gc/shared/plab.cpp

Print this page

        

@@ -42,11 +42,13 @@
 PLAB::PLAB(size_t desired_plab_sz_) :
   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
   _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
 {
   // ArrayOopDesc::header_size depends on command line initialization.
-  AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
+  int rsv_regular  = oopDesc::header_size() + (int) Universe::heap()->oop_extra_words();
+  int rsv_array    = align_object_size(arrayOopDesc::header_size(T_INT) + Universe::heap()->oop_extra_words());
+  AlignmentReserve = rsv_regular > MinObjAlignment ? rsv_array : 0;
   assert(min_size() > AlignmentReserve,
          "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " "
          "to be able to contain objects", min_size(), AlignmentReserve);
 }
 

@@ -80,10 +82,12 @@
 }
 
 size_t PLAB::retire_internal() {
   size_t result = 0;
   if (_top < _hard_end) {
+    assert(pointer_delta(_hard_end, _top) >= (size_t)(oopDesc::header_size() + Universe::heap()->oop_extra_words()),
+           "better have enough space left to fill with dummy");
     Universe::heap()->fill_with_dummy_object(_top, _hard_end, true);
     result += invalidate();
   }
   return result;
 }
< prev index next >