diff src/share/vm/memory/threadLocalAllocBuffer.cpp @ 20756:060cdf93040c jdk8u31-b04

8055479: TLAB stability Reviewed-by: brutisso, stefank, ahgross
author mgerdin
date Thu, 09 Oct 2014 15:42:23 +0200
parents 78bbf4d43a14
children 7848fc12602b
line wrap: on
line diff
--- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Fri Sep 26 17:48:10 2014 -0400
+++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Thu Oct 09 15:42:23 2014 +0200
@@ -235,22 +235,19 @@
 }
 
 size_t ThreadLocalAllocBuffer::initial_desired_size() {
-  size_t init_sz;
+  size_t init_sz = 0;
 
   if (TLABSize > 0) {
-    init_sz = MIN2(TLABSize / HeapWordSize, max_size());
-  } else if (global_stats() == NULL) {
-    // Startup issue - main thread initialized before heap initialized.
-    init_sz = min_size();
-  } else {
+    init_sz = TLABSize / HeapWordSize;
+  } else if (global_stats() != NULL) {
     // Initial size is a function of the average number of allocating threads.
     unsigned nof_threads = global_stats()->allocating_threads_avg();
 
     init_sz  = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
                       (nof_threads * target_refills());
     init_sz = align_object_size(init_sz);
-    init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   }
+  init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   return init_sz;
 }