< prev index next >
src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
Print this page
rev 8203 : [mq]: backout
*** 21,45 ****
* questions.
*
*/
#include "precompiled.hpp"
! #include "gc_implementation/shared/plab.hpp"
#include "memory/threadLocalAllocBuffer.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
! size_t PLAB::min_size() {
// Make sure that we return something that is larger than AlignmentReserve
return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
}
! size_t PLAB::max_size() {
return ThreadLocalAllocBuffer::max_size();
}
! 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)
{
// ArrayOopDesc::header_size depends on command line initialization.
AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
--- 21,45 ----
* questions.
*
*/
#include "precompiled.hpp"
! #include "gc_implementation/shared/parGCAllocBuffer.hpp"
#include "memory/threadLocalAllocBuffer.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
! size_t ParGCAllocBuffer::min_size() {
// Make sure that we return something that is larger than AlignmentReserve
return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
}
! size_t ParGCAllocBuffer::max_size() {
return ThreadLocalAllocBuffer::max_size();
}
! ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
_word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
_end(NULL), _hard_end(NULL), _allocated(0), _wasted(0)
{
// ArrayOopDesc::header_size depends on command line initialization.
AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
*** 51,63 ****
// If the minimum object size is greater than MinObjAlignment, we can
// end up with a shard at the end of the buffer that's smaller than
// the smallest object. We can't allow that because the buffer must
// look like it's full of objects when we retire it, so we make
// sure we have enough space for a filler int array object.
! size_t PLAB::AlignmentReserve;
! void PLAB::flush_and_retire_stats(PLABStats* stats) {
// Retire the last allocation buffer.
size_t unused = retire_internal();
// Now flush the statistics.
stats->add_allocated(_allocated);
--- 51,63 ----
// If the minimum object size is greater than MinObjAlignment, we can
// end up with a shard at the end of the buffer that's smaller than
// the smallest object. We can't allow that because the buffer must
// look like it's full of objects when we retire it, so we make
// sure we have enough space for a filler int array object.
! size_t ParGCAllocBuffer::AlignmentReserve;
! void ParGCAllocBuffer::flush_and_retire_stats(PLABStats* stats) {
// Retire the last allocation buffer.
size_t unused = retire_internal();
// Now flush the statistics.
stats->add_allocated(_allocated);
*** 69,83 ****
// will artifically inflate the values in the statistics.
_allocated = 0;
_wasted = 0;
}
! void PLAB::retire() {
_wasted += retire_internal();
}
! size_t PLAB::retire_internal() {
size_t result = 0;
if (_top < _hard_end) {
CollectedHeap::fill_with_object(_top, _hard_end);
result += invalidate();
}
--- 69,83 ----
// will artifically inflate the values in the statistics.
_allocated = 0;
_wasted = 0;
}
! void ParGCAllocBuffer::retire() {
_wasted += retire_internal();
}
! size_t ParGCAllocBuffer::retire_internal() {
size_t result = 0;
if (_top < _hard_end) {
CollectedHeap::fill_with_object(_top, _hard_end);
result += invalidate();
}
*** 124,134 ****
reset();
}
#ifndef PRODUCT
! void PLAB::print() {
! gclog_or_tty->print_cr("PLAB: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
" _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT ")",
p2i(_bottom), p2i(_top), p2i(_end), p2i(_hard_end));
}
#endif // !PRODUCT
--- 124,134 ----
reset();
}
#ifndef PRODUCT
! void ParGCAllocBuffer::print() {
! gclog_or_tty->print_cr("parGCAllocBuffer: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
" _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT ")",
p2i(_bottom), p2i(_top), p2i(_end), p2i(_hard_end));
}
#endif // !PRODUCT
< prev index next >