< prev index next >
src/share/vm/gc_implementation/shared/plab.cpp
Print this page
rev 8154 : plab_fixed_again
*** 22,31 ****
--- 22,32 ----
*
*/
#include "precompiled.hpp"
#include "gc_implementation/shared/plab.hpp"
+ #include "gc_interface/collectedHeap.hpp"
#include "memory/threadLocalAllocBuffer.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
size_t PLAB::min_size() {
*** 84,93 ****
--- 85,116 ----
result += invalidate();
}
return result;
}
+ void PLAB::add_undo_waste(HeapWord* obj, size_t word_sz) {
+ CollectedHeap::fill_with_object(obj, word_sz);
+ _undo_wasted += word_sz;
+ }
+
+ void PLAB::undo_last_allocation(HeapWord* obj, size_t word_sz) {
+ assert(pointer_delta(_top, _bottom) >= word_sz, "Bad undo");
+ assert(pointer_delta(_top, obj) == word_sz, "Bad undo");
+ _top = obj;
+ }
+
+ void PLAB::undo_allocation(HeapWord* obj, size_t word_sz) {
+ // Is the alloc in the current alloc buffer?
+ if (contains(obj)) {
+ assert(contains(obj + word_sz - 1),
+ "should contain whole object");
+ undo_last_allocation(obj, word_sz);
+ } else {
+ add_undo_waste(obj, word_sz);
+ }
+ }
+
// Compute desired plab size and latch result for later
// use. This should be called once at the end of parallel
// scavenge; it clears the sensor accumulators.
void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) {
assert(ResizePLAB, "Not set");
*** 98,108 ****
if (_allocated == 0) {
assert(_unused == 0,
err_msg("Inconsistency in PLAB stats: "
"_allocated: "SIZE_FORMAT", "
"_wasted: "SIZE_FORMAT", "
! "_unused: "SIZE_FORMAT", ",
"_undo_wasted: "SIZE_FORMAT,
_allocated, _wasted, _unused, _undo_wasted));
_allocated = 1;
}
--- 121,131 ----
if (_allocated == 0) {
assert(_unused == 0,
err_msg("Inconsistency in PLAB stats: "
"_allocated: "SIZE_FORMAT", "
"_wasted: "SIZE_FORMAT", "
! "_unused: "SIZE_FORMAT", "
"_undo_wasted: "SIZE_FORMAT,
_allocated, _wasted, _unused, _undo_wasted));
_allocated = 1;
}
< prev index next >