8141042: Typos and refactoring in Compiler constraints functions
authorddmitriev
Mon, 02 Nov 2015 11:32:26 +0300
changeset 33744 8dd886109959
parent 33739 e1df46512ae2
child 33745 262073218472
8141042: Typos and refactoring in Compiler constraints functions Reviewed-by: vlivanov, zmajo, kvn
hotspot/src/os/solaris/vm/os_solaris.cpp
hotspot/src/os/solaris/vm/os_solaris.hpp
hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Sat Oct 31 15:27:48 2015 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon Nov 02 11:32:26 2015 +0300
@@ -138,11 +138,6 @@
   #define LGRP_RSRC_MEM      1       /* memory resources */
 #endif
 
-// see thr_setprio(3T) for the basis of these numbers
-#define MinimumPriority 0
-#define NormalPriority  64
-#define MaximumPriority 127
-
 // Values for ThreadPriorityPolicy == 1
 int prio_policy1[CriticalPriority+1] = {
   -99999,  0, 16,  32,  48,  64,
@@ -3138,7 +3133,7 @@
 static int  myCur       = 0;
 static bool priocntl_enable = false;
 
-static const int criticalPrio = 60; // FX/60 is critical thread class/priority on T4
+static const int criticalPrio = FXCriticalPriority;
 static int java_MaxPriority_to_os_priority = 0; // Saved mapping
 
 
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp	Sat Oct 31 15:27:48 2015 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp	Mon Nov 02 11:32:26 2015 +0300
@@ -27,6 +27,14 @@
 
 // Solaris_OS defines the interface to Solaris operating systems
 
+// see thr_setprio(3T) for the basis of these numbers
+#define MinimumPriority 0
+#define NormalPriority  64
+#define MaximumPriority 127
+
+// FX/60 is critical thread class/priority on T4
+#define FXCriticalPriority 60
+
 // Information about the protection of the page at address '0' on this os.
 static bool zero_page_read_protected() { return true; }
 
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Sat Oct 31 15:27:48 2015 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Mon Nov 02 11:32:26 2015 +0300
@@ -34,10 +34,10 @@
 #include "utilities/defaultStream.hpp"
 
 Flag::Error AliasLevelConstraintFunc(intx value, bool verbose) {
-  if ((value <= 1) && (Arguments::mode() == Arguments::_comp)) {
+  if ((value <= 1) && (Arguments::mode() == Arguments::_comp || Arguments::mode() == Arguments::_mixed)) {
     CommandLineError::print(verbose,
                             "AliasLevel (" INTX_FORMAT ") is not "
-                            "compatible with -Xcomp \n",
+                            "compatible with -Xcomp or -Xmixed\n",
                             value);
     return Flag::VIOLATES_CONSTRAINT;
   } else {
@@ -118,10 +118,10 @@
 }
 
 Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
-  if (value < 0 || value > max_jint) {
+  if (value < 1 || value > max_jint) {
     CommandLineError::print(verbose,
                             "AllocatePrefetchStepSize (" INTX_FORMAT ") "
-                            "must be between 0 and %d\n",
+                            "must be between 1 and %d\n",
                             AllocatePrefetchStepSize,
                             max_jint);
     return Flag::VIOLATES_CONSTRAINT;
@@ -206,7 +206,7 @@
   if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) {
     CommandLineError::print(verbose,
                             "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
-                            "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ")"
+                            "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") "
                             "to align entry points\n",
                             CodeCacheSegmentSize, CodeEntryAlignment);
     return Flag::VIOLATES_CONSTRAINT;
@@ -224,7 +224,7 @@
   if (CodeCacheSegmentSize < (uintx)OptoLoopAlignment) {
     CommandLineError::print(verbose,
                             "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
-                            "larger than or equal to OptoLoopAlignment (" INTX_FORMAT ")"
+                            "larger than or equal to OptoLoopAlignment (" INTX_FORMAT ") "
                             "to align inner loops\n",
                             CodeCacheSegmentSize, OptoLoopAlignment);
     return Flag::VIOLATES_CONSTRAINT;
@@ -235,15 +235,17 @@
 }
 
 Flag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose) {
-  if (value < min_jint || value > max_jint) {
+#ifdef SOLARIS
+  if ((value < MinimumPriority || value > MaximumPriority) &&
+      (value != -1) && (value != -FXCriticalPriority)) {
     CommandLineError::print(verbose,
-                            "CompileThreadPriority (" INTX_FORMAT ") "
-                            "must be between %d and %d. "
-                            "Please also make sure to specify values that are "
-                            "meaningful to your operating system\n",
-                            value, min_jint, max_jint);
+                            "CompileThreadPriority (" INTX_FORMAT ") must be "
+                            "between %d and %d inclusively or -1 (means no change) "
+                            "or %d (special value for critical thread class/priority)\n",
+                            value, MinimumPriority, MaximumPriority, -FXCriticalPriority);
     return Flag::VIOLATES_CONSTRAINT;
   }
+#endif
 
   return Flag::SUCCESS;
 }
@@ -277,14 +279,6 @@
 }
 
 Flag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) {
-  if (value < 0 || value > 16) {
-    CommandLineError::print(verbose,
-                            "OptoLoopAlignment (" INTX_FORMAT ") "
-                            "must be between 0 and 16\n",
-                            value);
-    return Flag::VIOLATES_CONSTRAINT;
-  }
-
   if (!is_power_of_2(value)) {
     CommandLineError::print(verbose,
                             "OptoLoopAlignment (" INTX_FORMAT ") "
@@ -308,7 +302,8 @@
 Flag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
   if (value != 0) {
     CommandLineError::print(verbose,
-                            "ArraycopyDstPrefetchDistance (" INTX_FORMAT ") must be 0\n");
+                            "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
+                            value);
     return Flag::VIOLATES_CONSTRAINT;
   }
 
@@ -318,7 +313,8 @@
 Flag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
   if (value != 0) {
     CommandLineError::print(verbose,
-                            "ArraycopySrcPrefetchDistance (" INTX_FORMAT ") must be 0\n");
+                            "ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
+                            value);
     return Flag::VIOLATES_CONSTRAINT;
   }
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Sat Oct 31 15:27:48 2015 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Nov 02 11:32:26 2015 +0300
@@ -3085,6 +3085,7 @@
                                                                             \
   product(intx,  AllocatePrefetchStepSize, 16,                              \
           "Step size in bytes of sequential prefetch instructions")         \
+          range(1, max_jint)                                                \
           constraint(AllocatePrefetchStepSizeConstraintFunc,AfterMemoryInit)\
                                                                             \
   product(intx,  AllocatePrefetchInstr, 0,                                  \
@@ -3568,6 +3569,7 @@
                                                                             \
   product_pd(intx, OptoLoopAlignment,                                       \
           "Align inner loops to zero relative to this modulus")             \
+          range(1, 16)                                                      \
           constraint(OptoLoopAlignmentConstraintFunc, AfterErgo)            \
                                                                             \
   product_pd(uintx, InitialCodeCacheSize,                                   \
@@ -3729,6 +3731,7 @@
   product(intx, CompilerThreadPriority, -1,                                 \
           "The native priority at which compiler threads should run "       \
           "(-1 means no change)")                                           \
+          range(min_jint, max_jint)                                         \
           constraint(CompilerThreadPriorityConstraintFunc, AfterErgo)       \
                                                                             \
   product(intx, VMThreadPriority, -1,                                       \