hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
changeset 40364 5bf8fa4fddfd
parent 40074 135bb8aa1e18
child 42650 1f304d0c888b
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Wed Aug 03 15:52:38 2016 +0000
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Thu Aug 04 08:58:22 2016 +0200
@@ -147,12 +147,18 @@
   // performed on 32-bit systems because it can lead to exhaustion
   // of the virtual memory address space available to the JVM.
   if (CICompilerCountPerCPU) {
-    count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2;
+    count = MAX2(log2_intptr(os::active_processor_count()) * 3 / 2, 2);
+    FLAG_SET_ERGO(intx, CICompilerCount, count);
   }
 #endif
-  set_c1_count(MAX2(count / 3, 1));
-  set_c2_count(MAX2(count - c1_count(), 1));
-  FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
+  if (TieredStopAtLevel < CompLevel_full_optimization) {
+    // No C2 compiler thread required
+    set_c1_count(count);
+  } else {
+    set_c1_count(MAX2(count / 3, 1));
+    set_c2_count(MAX2(count - c1_count(), 1));
+  }
+  assert(count == c1_count() + c2_count(), "inconsistent compiler thread count");
 }
 
 void SimpleThresholdPolicy::set_carry_if_necessary(InvocationCounter *counter) {