< prev index next >

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

Print this page




 121     if (retire) {
 122       thread()->incr_allocated_bytes(used_bytes());
 123     }
 124 
 125     Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap);
 126 
 127     if (retire || ZeroTLAB) {  // "Reset" the TLAB
 128       set_start(NULL);
 129       set_top(NULL);
 130       set_pf_top(NULL);
 131       set_end(NULL);
 132       set_allocation_end(NULL);
 133     }
 134   }
 135   assert(!(retire || ZeroTLAB)  ||
 136          (start() == NULL && end() == NULL && top() == NULL &&
 137           _allocation_end == NULL),
 138          "TLAB must be reset");
 139 }
 140 
 141 void ThreadLocalAllocBuffer::resize_all_tlabs() {
 142   if (ResizeTLAB) {
 143     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
 144       thread->tlab().resize();
 145     }
 146   }
 147 }
 148 
 149 void ThreadLocalAllocBuffer::resize() {
 150   // Compute the next tlab size using expected allocation amount
 151   assert(ResizeTLAB, "Should not call this otherwise");
 152   size_t alloc = (size_t)(_allocation_fraction.average() *
 153                           (Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
 154   size_t new_size = alloc / _target_refills;
 155 
 156   new_size = MIN2(MAX2(new_size, min_size()), max_size());
 157 
 158   size_t aligned_new_size = align_object_size(new_size);
 159 
 160   log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
 161                       " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
 162                       p2i(thread()), thread()->osthread()->thread_id(),
 163                       _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size);
 164 
 165   set_desired_size(aligned_new_size);
 166   set_refill_waste_limit(initial_refill_waste_limit());
 167 }
 168 




 121     if (retire) {
 122       thread()->incr_allocated_bytes(used_bytes());
 123     }
 124 
 125     Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap);
 126 
 127     if (retire || ZeroTLAB) {  // "Reset" the TLAB
 128       set_start(NULL);
 129       set_top(NULL);
 130       set_pf_top(NULL);
 131       set_end(NULL);
 132       set_allocation_end(NULL);
 133     }
 134   }
 135   assert(!(retire || ZeroTLAB)  ||
 136          (start() == NULL && end() == NULL && top() == NULL &&
 137           _allocation_end == NULL),
 138          "TLAB must be reset");
 139 }
 140 








 141 void ThreadLocalAllocBuffer::resize() {
 142   // Compute the next tlab size using expected allocation amount
 143   assert(ResizeTLAB, "Should not call this otherwise");
 144   size_t alloc = (size_t)(_allocation_fraction.average() *
 145                           (Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
 146   size_t new_size = alloc / _target_refills;
 147 
 148   new_size = MIN2(MAX2(new_size, min_size()), max_size());
 149 
 150   size_t aligned_new_size = align_object_size(new_size);
 151 
 152   log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
 153                       " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
 154                       p2i(thread()), thread()->osthread()->thread_id(),
 155                       _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size);
 156 
 157   set_desired_size(aligned_new_size);
 158   set_refill_waste_limit(initial_refill_waste_limit());
 159 }
 160 


< prev index next >