< prev index next >
src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
Print this page
rev 56944 : imported patch 8233702-function-to-clamp-value-to-range
rev 56945 : imported patch 8233702-rerun-tests
rev 56946 : imported patch 8233702-kbarrett-review
*** 130,140 ****
assert(ResizeTLAB, "Should not call this otherwise");
size_t alloc = (size_t)(_allocation_fraction.average() *
(Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
size_t new_size = alloc / _target_refills;
! new_size = MIN2(MAX2(new_size, min_size()), max_size());
size_t aligned_new_size = align_object_size(new_size);
log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
" refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
--- 130,140 ----
assert(ResizeTLAB, "Should not call this otherwise");
size_t alloc = (size_t)(_allocation_fraction.average() *
(Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
size_t new_size = alloc / _target_refills;
! new_size = clamp(new_size, min_size(), max_size());
size_t aligned_new_size = align_object_size(new_size);
log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
" refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
*** 249,258 ****
--- 249,261 ----
init_sz = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) /
(nof_threads * target_refills());
init_sz = align_object_size(init_sz);
}
+ // We can't use clamp() between min_size() and max_size() here because some
+ // options based on them may still be inconsistent; inconsistencies between
+ // those will be caught by following AfterMemoryInit constraint checking.
init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
return init_sz;
}
void ThreadLocalAllocBuffer::print_stats(const char* tag) {
< prev index next >