< prev index next >
src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
Print this page
rev 48551 : [mq]: heap8
rev 48553 : [mq]: heap14_rebased
rev 48559 : [mq]: heap20
rev 48562 : [mq]: heap23
rev 48563 : [mq]: heap_to_thread
rev 48564 : [mq]: update-spec
rev 48565 : [mq]: event
*** 50,61 ****
size_t ThreadLocalAllocBuffer::remaining() {
if (current_end() == NULL) {
return 0;
}
- // TODO: To be deprecated when FastTLABRefill is deprecated.
- update_end_pointers();
return pointer_delta(reserved_end(), top());
}
void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() {
global_stats()->initialize();
--- 50,59 ----
*** 124,149 ****
if (retire) {
myThread()->incr_allocated_bytes(used_bytes());
}
- // TODO: To be deprecated when FastTLABRefill is deprecated.
- update_end_pointers();
CollectedHeap::fill_with_object(top(), reserved_end(), retire && zap);
if (retire || ZeroTLAB) { // "Reset" the TLAB
set_start(NULL);
set_top(NULL);
set_pf_top(NULL);
set_current_end(NULL);
set_allocation_end(NULL);
- set_last_slow_path_end(NULL);
}
}
assert(!(retire || ZeroTLAB) ||
(start() == NULL && current_end() == NULL && top() == NULL &&
! _allocation_end == NULL && _last_slow_path_end == NULL),
"TLAB must be reset");
}
void ThreadLocalAllocBuffer::resize_all_tlabs() {
if (ResizeTLAB) {
--- 122,144 ----
if (retire) {
myThread()->incr_allocated_bytes(used_bytes());
}
CollectedHeap::fill_with_object(top(), reserved_end(), retire && zap);
if (retire || ZeroTLAB) { // "Reset" the TLAB
set_start(NULL);
set_top(NULL);
set_pf_top(NULL);
set_current_end(NULL);
set_allocation_end(NULL);
}
}
assert(!(retire || ZeroTLAB) ||
(start() == NULL && current_end() == NULL && top() == NULL &&
! _allocation_end == NULL),
"TLAB must be reset");
}
void ThreadLocalAllocBuffer::resize_all_tlabs() {
if (ResizeTLAB) {
*** 204,214 ****
set_start(start);
set_top(top);
set_pf_top(top);
set_current_end(end);
set_allocation_end(end);
- set_last_slow_path_end(end);
invariants();
}
void ThreadLocalAllocBuffer::initialize() {
initialize(NULL, // start
--- 199,208 ----
*** 329,345 ****
guarantee(p == top(), "end of last object must match end of space");
}
void ThreadLocalAllocBuffer::set_sample_end() {
size_t heap_words_remaining = pointer_delta(_current_end, _top);
! size_t bytes_until_sample = myThread()->bytes_until_sample();
size_t words_until_sample = bytes_until_sample / HeapWordSize;;
if (heap_words_remaining > words_until_sample) {
HeapWord* new_end = _top + words_until_sample;
set_current_end(new_end);
- set_last_slow_path_end(new_end);
_bytes_since_last_sample_point = bytes_until_sample;
} else {
_bytes_since_last_sample_point = heap_words_remaining * HeapWordSize;;
}
}
--- 323,338 ----
guarantee(p == top(), "end of last object must match end of space");
}
void ThreadLocalAllocBuffer::set_sample_end() {
size_t heap_words_remaining = pointer_delta(_current_end, _top);
! size_t bytes_until_sample = myThread()->heap_sampler().bytes_until_sample();
size_t words_until_sample = bytes_until_sample / HeapWordSize;;
if (heap_words_remaining > words_until_sample) {
HeapWord* new_end = _top + words_until_sample;
set_current_end(new_end);
_bytes_since_last_sample_point = bytes_until_sample;
} else {
_bytes_since_last_sample_point = heap_words_remaining * HeapWordSize;;
}
}
*** 349,388 ****
in_bytes(start_offset()) -
in_bytes(Thread::tlab_start_offset()));
}
void ThreadLocalAllocBuffer::set_back_allocation_end() {
- update_end_pointers();
_current_end = _allocation_end;
}
- void ThreadLocalAllocBuffer::update_end_pointers() {
- // Did a fast TLAB refill occur? (This will be deprecated when fast TLAB
- // refill disappears).
- if (_last_slow_path_end != _current_end) {
- // Fix up the last slow path end to be now the end of this TLAB.
- _last_slow_path_end = _current_end;
- _allocation_end = _current_end;
- }
- }
-
HeapWord* ThreadLocalAllocBuffer::allocate_sampled_object(size_t size) {
Thread* thread = myThread();
thread->tlab().set_back_allocation_end();
HeapWord* result = thread->tlab().allocate(size);
if (result) {
! thread->check_for_sampling(result, size * HeapWordSize, _bytes_since_last_sample_point);
thread->tlab().set_sample_end();
}
return result;
}
HeapWord* ThreadLocalAllocBuffer::reserved_end() {
- assert (_last_slow_path_end == _current_end,
- "Have to call update_end_pointers before reserved_end.");
return _allocation_end + alignment_reserve();
}
GlobalTLABStats::GlobalTLABStats() :
_allocating_threads_avg(TLABAllocationWeight) {
--- 342,368 ----
in_bytes(start_offset()) -
in_bytes(Thread::tlab_start_offset()));
}
void ThreadLocalAllocBuffer::set_back_allocation_end() {
_current_end = _allocation_end;
}
HeapWord* ThreadLocalAllocBuffer::allocate_sampled_object(size_t size) {
Thread* thread = myThread();
thread->tlab().set_back_allocation_end();
HeapWord* result = thread->tlab().allocate(size);
if (result) {
! thread->heap_sampler().check_for_sampling(result, size * HeapWordSize, _bytes_since_last_sample_point);
thread->tlab().set_sample_end();
}
return result;
}
HeapWord* ThreadLocalAllocBuffer::reserved_end() {
return _allocation_end + alignment_reserve();
}
GlobalTLABStats::GlobalTLABStats() :
_allocating_threads_avg(TLABAllocationWeight) {
< prev index next >