Mercurial > hg > graal-compiler
comparison src/share/vm/memory/threadLocalAllocBuffer.cpp @ 21811:22ac20a25842
8055479: TLAB stability
Reviewed-by: brutisso, stefank, ahgross
author | mgerdin |
---|---|
date | Thu, 09 Oct 2014 15:42:23 +0200 |
parents | 78bbf4d43a14 |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
21810:0366a71eda74 | 21811:22ac20a25842 |
---|---|
233 min_size(), Thread::current()->tlab().initial_desired_size(), max_size()); | 233 min_size(), Thread::current()->tlab().initial_desired_size(), max_size()); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 size_t ThreadLocalAllocBuffer::initial_desired_size() { | 237 size_t ThreadLocalAllocBuffer::initial_desired_size() { |
238 size_t init_sz; | 238 size_t init_sz = 0; |
239 | 239 |
240 if (TLABSize > 0) { | 240 if (TLABSize > 0) { |
241 init_sz = MIN2(TLABSize / HeapWordSize, max_size()); | 241 init_sz = TLABSize / HeapWordSize; |
242 } else if (global_stats() == NULL) { | 242 } else if (global_stats() != NULL) { |
243 // Startup issue - main thread initialized before heap initialized. | |
244 init_sz = min_size(); | |
245 } else { | |
246 // Initial size is a function of the average number of allocating threads. | 243 // Initial size is a function of the average number of allocating threads. |
247 unsigned nof_threads = global_stats()->allocating_threads_avg(); | 244 unsigned nof_threads = global_stats()->allocating_threads_avg(); |
248 | 245 |
249 init_sz = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) / | 246 init_sz = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) / |
250 (nof_threads * target_refills()); | 247 (nof_threads * target_refills()); |
251 init_sz = align_object_size(init_sz); | 248 init_sz = align_object_size(init_sz); |
252 init_sz = MIN2(MAX2(init_sz, min_size()), max_size()); | 249 } |
253 } | 250 init_sz = MIN2(MAX2(init_sz, min_size()), max_size()); |
254 return init_sz; | 251 return init_sz; |
255 } | 252 } |
256 | 253 |
257 void ThreadLocalAllocBuffer::print_stats(const char* tag) { | 254 void ThreadLocalAllocBuffer::print_stats(const char* tag) { |
258 Thread* thrd = myThread(); | 255 Thread* thrd = myThread(); |