< prev index next >

src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp

Print this page
rev 56881 : imported patch 8233702-function-to-clamp-value-to-range

@@ -130,11 +130,11 @@
   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());
+  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,11 +249,11 @@
 
     init_sz  = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) /
                       (nof_threads * target_refills());
     init_sz = align_object_size(init_sz);
   }
-  init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
+  init_sz = clamp(init_sz, min_size(), max_size());
   return init_sz;
 }
 
 void ThreadLocalAllocBuffer::print_stats(const char* tag) {
   Log(gc, tlab) log;
< prev index next >