src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
changeset 59221 cc3a82fc7bcb
parent 54659 62d6baca22fc
equal deleted inserted replaced
59220:72e15d757e6c 59221:cc3a82fc7bcb
   130   assert(ResizeTLAB, "Should not call this otherwise");
   130   assert(ResizeTLAB, "Should not call this otherwise");
   131   size_t alloc = (size_t)(_allocation_fraction.average() *
   131   size_t alloc = (size_t)(_allocation_fraction.average() *
   132                           (Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
   132                           (Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
   133   size_t new_size = alloc / _target_refills;
   133   size_t new_size = alloc / _target_refills;
   134 
   134 
   135   new_size = MIN2(MAX2(new_size, min_size()), max_size());
   135   new_size = clamp(new_size, min_size(), max_size());
   136 
   136 
   137   size_t aligned_new_size = align_object_size(new_size);
   137   size_t aligned_new_size = align_object_size(new_size);
   138 
   138 
   139   log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
   139   log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
   140                       " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
   140                       " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
   249 
   249 
   250     init_sz  = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) /
   250     init_sz  = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) /
   251                       (nof_threads * target_refills());
   251                       (nof_threads * target_refills());
   252     init_sz = align_object_size(init_sz);
   252     init_sz = align_object_size(init_sz);
   253   }
   253   }
       
   254   // We can't use clamp() between min_size() and max_size() here because some
       
   255   // options based on them may still be inconsistent and so it may assert;
       
   256   // inconsistencies between those will be caught by following AfterMemoryInit
       
   257   // constraint checking.
   254   init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   258   init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   255   return init_sz;
   259   return init_sz;
   256 }
   260 }
   257 
   261 
   258 void ThreadLocalAllocBuffer::print_stats(const char* tag) {
   262 void ThreadLocalAllocBuffer::print_stats(const char* tag) {