changeset 6389:c6d29f2731d5

8041992: Fix of JDK-8034775 neglects to account for non-JIT VMs Summary: Allow 0 compiler threads if no JIT is used. Reviewed-by: kvn, dholmes Contributed-by: Severin Gehwolf <sgehwolf@redhat.com>
author anoll
date Fri, 02 May 2014 06:24:39 +0200
parents 9883c95f17f6
children d54237e9d713
files src/share/vm/runtime/arguments.cpp test/compiler/startup/NumCompilerThreadsCheck.java
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Tue Apr 29 12:20:53 2014 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Fri May 02 06:24:39 2014 +0200
@@ -2399,7 +2399,7 @@
   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
 
   // TieredCompilation needs at least 2 compiler threads.
-  const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : 1;
+  const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : CI_COMPILER_COUNT;
   status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
 
   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
--- a/test/compiler/startup/NumCompilerThreadsCheck.java	Tue Apr 29 12:20:53 2014 -0700
+++ b/test/compiler/startup/NumCompilerThreadsCheck.java	Fri May 02 06:24:39 2014 +0200
@@ -30,11 +30,28 @@
 import com.oracle.java.testlibrary.*;
 
 public class NumCompilerThreadsCheck {
+
   public static void main(String[] args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1");
     OutputAnalyzer out = new OutputAnalyzer(pb.start());
 
     String expectedOutput = "CICompilerCount of -1 is invalid";
     out.shouldContain(expectedOutput);
+
+    if (isZeroVm()) {
+      String expectedLowWaterMarkText = "must be at least 0";
+      out.shouldContain(expectedLowWaterMarkText);
+    }
+  }
+
+  private static boolean isZeroVm() {
+    String vmName = System.getProperty("java.vm.name");
+    if (vmName == null) {
+      throw new RuntimeException("No VM name");
+    }
+    if (vmName.toLowerCase().contains("zero")) {
+      return true;
+    }
+    return false;
   }
 }