8042431: compiler/7200264/TestIntVect.java fails with: Test Failed: AddVI 0 < 4
authoranoll
Thu, 08 May 2014 12:49:21 +0200
changeset 24437 4770f8076932
parent 24351 61b33cc6d3cf
child 24438 d0eddc193c1b
8042431: compiler/7200264/TestIntVect.java fails with: Test Failed: AddVI 0 < 4 Summary: Define a new function that determines the minimum number of compiler threads for a particular platform/configuration. Reviewed-by: kvn
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/arguments.hpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Apr 29 15:17:27 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu May 08 12:49:21 2014 +0200
@@ -1151,6 +1151,32 @@
   }
 }
 
+/**
+ * Returns the minimum number of compiler threads needed to run the JVM. The following
+ * configurations are possible.
+ *
+ * 1) The JVM is build using an interpreter only. As a result, the minimum number of
+ *    compiler threads is 0.
+ * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
+ *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
+ * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
+ *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
+ *    C1 can be used, so the minimum number of compiler threads is 1.
+ * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
+ *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
+ *    the minimum number of compiler threads is 2.
+ */
+int Arguments::get_min_number_of_compiler_threads() {
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
+  return 0;   // case 1
+#else
+  if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
+    return 1; // case 2 or case 3
+  }
+  return 2;   // case 4 (tiered)
+#endif
+}
+
 #if INCLUDE_ALL_GCS
 static void disable_adaptive_size_policy(const char* collector_name) {
   if (UseAdaptiveSizePolicy) {
@@ -2398,9 +2424,11 @@
   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
   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 : CI_COMPILER_COUNT;
-  status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
+  int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
+  // The default CICompilerCount's value is CI_COMPILER_COUNT.
+  assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
+  // Check the minimum number of compiler threads
+  status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
 
   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Tue Apr 29 15:17:27 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Thu May 08 12:49:21 2014 +0200
@@ -323,6 +323,7 @@
 
   // Tiered
   static void set_tiered_flags();
+  static int  get_min_number_of_compiler_threads();
   // CMS/ParNew garbage collectors
   static void set_parnew_gc_flags();
   static void set_cms_and_parnew_gc_flags();