From c5790f932bd32fcbff060bbeb012696841e84dc2 Mon Sep 17 00:00:00 2001 From: anoll Date: Fri, 2 May 2014 06:24:39 +0200 Subject: [PATCH] 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 --- src/share/vm/runtime/arguments.cpp | 2 +- .../startup/NumCompilerThreadsCheck.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index 8e47ea374..5fbd3765f 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2463,7 +2463,7 @@ bool Arguments::check_vm_args_consistency() { #endif // 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"); return status; diff --git a/test/compiler/startup/NumCompilerThreadsCheck.java b/test/compiler/startup/NumCompilerThreadsCheck.java index e7e92d379..1cfd757fd 100644 --- a/test/compiler/startup/NumCompilerThreadsCheck.java +++ b/test/compiler/startup/NumCompilerThreadsCheck.java @@ -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; } } -- GitLab