comparison src/share/vm/memory/threadLocalAllocBuffer.cpp @ 8504:86b4965f0c9a

-Cleanup code
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Wed, 20 Mar 2013 21:39:24 +0100
parents ff4fa8b0516e
children d8041d695d19
comparison
equal deleted inserted replaced
8503:58385e7565ff 8504:86b4965f0c9a
142 142
143 new_size = MIN2(MAX2(new_size, min_size()), max_size()); 143 new_size = MIN2(MAX2(new_size, min_size()), max_size());
144 144
145 size_t aligned_new_size = align_object_size(new_size); 145 size_t aligned_new_size = align_object_size(new_size);
146 146
147 //if (PrintTLAB && Verbose) { 147 if (PrintTLAB && Verbose) {
148 gclog_or_tty->print("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]" 148 gclog_or_tty->print("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
149 " refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT "\n", 149 " refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT "\n",
150 myThread(), myThread()->osthread()->thread_id(), 150 myThread(), myThread()->osthread()->thread_id(),
151 _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size); 151 _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size);
152 //} 152 }
153 set_desired_size(aligned_new_size); 153 set_desired_size(aligned_new_size);
154 154
155 set_refill_waste_limit(initial_refill_waste_limit()); 155 set_refill_waste_limit(initial_refill_waste_limit());
156 } 156 }
157 } 157 }
166 166
167 void ThreadLocalAllocBuffer::fill(HeapWord* start, 167 void ThreadLocalAllocBuffer::fill(HeapWord* start,
168 HeapWord* top, 168 HeapWord* top,
169 size_t new_size) { 169 size_t new_size) {
170 _number_of_refills++; 170 _number_of_refills++;
171 //if (PrintTLAB && Verbose) { 171 if (PrintTLAB && Verbose) {
172 print_stats("fill"); 172 print_stats("fill");
173 //} 173 }
174 assert(top <= start + new_size - alignment_reserve(), "size too small"); 174 assert(top <= start + new_size - alignment_reserve(), "size too small");
175 initialize(start, top, start + new_size - alignment_reserve()); 175 initialize(start, top, start + new_size - alignment_reserve());
176 176
177 // Reset amount of internal fragmentation 177 // Reset amount of internal fragmentation
178 set_refill_waste_limit(initial_refill_waste_limit()); 178 set_refill_waste_limit(initial_refill_waste_limit());
272 size_t alloc = _number_of_refills * _desired_size; 272 size_t alloc = _number_of_refills * _desired_size;
273 double waste_percent = alloc == 0 ? 0.0 : 273 double waste_percent = alloc == 0 ? 0.0 :
274 100.0 * waste / alloc; 274 100.0 * waste / alloc;
275 size_t tlab_used = Universe::heap()->tlab_capacity(thrd) - 275 size_t tlab_used = Universe::heap()->tlab_capacity(thrd) -
276 Universe::heap()->unsafe_max_tlab_alloc(thrd); 276 Universe::heap()->unsafe_max_tlab_alloc(thrd);
277 gclog_or_tty->print("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d] start addr 0x%16lx" 277 gclog_or_tty->print("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]"
278 " desired_size: " SIZE_FORMAT "KB" 278 " desired_size: " SIZE_FORMAT "KB"
279 " slow allocs: %d refill waste: " SIZE_FORMAT "B" 279 " slow allocs: %d refill waste: " SIZE_FORMAT "B"
280 " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB" 280 " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB"
281 " slow: %dB fast: %dB\n", 281 " slow: %dB fast: %dB\n",
282 tag, thrd, thrd->tlab().start(), thrd->osthread()->thread_id(), 282 tag, thrd, thrd->osthread()->thread_id(),
283 _desired_size / (K / HeapWordSize), 283 _desired_size / (K / HeapWordSize),
284 _slow_allocations, _refill_waste_limit * HeapWordSize, 284 _slow_allocations, _refill_waste_limit * HeapWordSize,
285 _allocation_fraction.average(), 285 _allocation_fraction.average(),
286 _allocation_fraction.average() * tlab_used / K, 286 _allocation_fraction.average() * tlab_used / K,
287 _number_of_refills, waste_percent, 287 _number_of_refills, waste_percent,