< prev index next >
src/hotspot/share/gc/shared/plab.cpp
Print this page
*** 24,33 ****
--- 24,34 ----
#include "precompiled.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/plab.inline.hpp"
#include "gc/shared/threadLocalAllocBuffer.hpp"
+ #include "memory/universe.hpp"
#include "logging/log.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
size_t PLAB::min_size() {
*** 42,52 ****
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;
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);
}
--- 43,56 ----
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.
! CollectedHeap* heap = Universe::heap();
! int rsv_regular = heap->obj_header_size();
! int rsv_array = align_object_size(heap->array_header_size(T_INT));
! 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,89 ****
--- 84,95 ----
}
size_t PLAB::retire_internal() {
size_t result = 0;
if (_top < _hard_end) {
+ assert(pointer_delta(_hard_end, _top) >= (size_t)(Universe::heap()->obj_header_size()),
+ "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 >