25 #include "precompiled.hpp" 26 #include "runtime/arguments.hpp" 27 #include "runtime/commandLineFlagConstraintsGC.hpp" 28 #include "runtime/globals.hpp" 29 #include "utilities/defaultStream.hpp" 30 31 #if INCLUDE_ALL_GCS 32 #include "gc/g1/g1_globals.hpp" 33 #endif // INCLUDE_ALL_GCS 34 #ifdef COMPILER1 35 #include "c1/c1_globals.hpp" 36 #endif // COMPILER1 37 #ifdef COMPILER2 38 #include "opto/c2_globals.hpp" 39 #endif // COMPILER2 40 41 Flag::Error MinHeapFreeRatioConstraintFunc(bool verbose, uintx* value) { 42 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxHeapFreeRatio)) { 43 if (verbose == true) { 44 jio_fprintf(defaultStream::error_stream(), 45 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " 46 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", 47 *value, MaxHeapFreeRatio); 48 } 49 return Flag::VIOLATES_CONSTRAINT; 50 } else { 51 return Flag::SUCCESS; 52 } 53 } 54 55 Flag::Error MaxHeapFreeRatioConstraintFunc(bool verbose, uintx* value) { 56 if ((CommandLineFlags::finishedInitializing()) && (*value < MinHeapFreeRatio)) { 57 if (verbose == true) { 58 jio_fprintf(defaultStream::error_stream(), 59 "MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or " 60 "equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n", 61 *value, MinHeapFreeRatio); 62 } 63 return Flag::VIOLATES_CONSTRAINT; 64 } else { 65 return Flag::SUCCESS; 66 } 67 } 68 69 Flag::Error MinMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) { 70 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxMetaspaceFreeRatio)) { 71 if (verbose == true) { 72 jio_fprintf(defaultStream::error_stream(), 73 "MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be less than or " 74 "equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n", 75 *value, MaxMetaspaceFreeRatio); 76 } 77 return Flag::VIOLATES_CONSTRAINT; 78 } else { 79 return Flag::SUCCESS; 80 } 81 } 82 83 Flag::Error MaxMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) { 84 if ((CommandLineFlags::finishedInitializing()) && (*value < MinMetaspaceFreeRatio)) { 85 if (verbose == true) { 86 jio_fprintf(defaultStream::error_stream(), 87 "MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be greater than or " 88 "equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n", 89 *value, MinMetaspaceFreeRatio); 90 } 91 return Flag::VIOLATES_CONSTRAINT; 92 } else { 93 return Flag::SUCCESS; 94 } 95 } 96 97 // GC workaround for "-XX:+UseConcMarkSweepGC" 98 // which sets InitialTenuringThreshold to 7 but leaves MaxTenuringThreshold remaining at 6 99 // and therefore would invalidate the constraint 100 #define UseConcMarkSweepGCWorkaroundIfNeeded(initial, max) { \ 101 if ((initial == 7) && (max == 6)) { \ 102 return Flag::SUCCESS; \ 103 } \ 104 } 105 106 Flag::Error InitialTenuringThresholdConstraintFunc(bool verbose, uintx* value) { 107 UseConcMarkSweepGCWorkaroundIfNeeded(*value, MaxTenuringThreshold); 108 109 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxTenuringThreshold)) { 110 if (verbose == true) { 111 jio_fprintf(defaultStream::error_stream(), 112 "InitialTenuringThreshold (" UINTX_FORMAT ") must be less than or " 113 "equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n", 114 *value, MaxTenuringThreshold); 115 } 116 return Flag::VIOLATES_CONSTRAINT; 117 } else { 118 return Flag::SUCCESS; 119 } 120 } 121 122 Flag::Error MaxTenuringThresholdConstraintFunc(bool verbose, uintx* value) { 123 UseConcMarkSweepGCWorkaroundIfNeeded(InitialTenuringThreshold, *value); 124 125 if ((CommandLineFlags::finishedInitializing()) && (*value < InitialTenuringThreshold)) { 126 if (verbose == true) { 127 jio_fprintf(defaultStream::error_stream(), 128 "MaxTenuringThreshold (" UINTX_FORMAT ") must be greater than or " 129 "equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n", 130 *value, InitialTenuringThreshold); 131 } 132 return Flag::VIOLATES_CONSTRAINT; 133 } else { 134 return Flag::SUCCESS; 135 } 136 } 137 138 #if INCLUDE_ALL_GCS 139 140 Flag::Error G1NewSizePercentConstraintFunc(bool verbose, uintx* value) { 141 if ((CommandLineFlags::finishedInitializing()) && (*value > G1MaxNewSizePercent)) { 142 if (verbose == true) { 143 jio_fprintf(defaultStream::error_stream(), 144 "G1NewSizePercent (" UINTX_FORMAT ") must be less than or " 145 "equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n", 146 *value, G1MaxNewSizePercent); 147 } 148 return Flag::VIOLATES_CONSTRAINT; 149 } else { 150 return Flag::SUCCESS; 151 } 152 } 153 154 Flag::Error G1MaxNewSizePercentConstraintFunc(bool verbose, uintx* value) { 155 if ((CommandLineFlags::finishedInitializing()) && (*value < G1NewSizePercent)) { 156 if (verbose == true) { 157 jio_fprintf(defaultStream::error_stream(), 158 "G1MaxNewSizePercent (" UINTX_FORMAT ") must be greater than or " 159 "equal to G1NewSizePercent (" UINTX_FORMAT ")\n", 160 *value, G1NewSizePercent); 161 } 162 return Flag::VIOLATES_CONSTRAINT; 163 } else { 164 return Flag::SUCCESS; 165 } 166 } 167 168 #endif // INCLUDE_ALL_GCS 169 170 Flag::Error CMSOldPLABMinConstraintFunc(bool verbose, size_t* value) { 171 if ((CommandLineFlags::finishedInitializing()) && (*value > CMSOldPLABMax)) { 172 if (verbose == true) { 173 jio_fprintf(defaultStream::error_stream(), 174 "CMSOldPLABMin (" SIZE_FORMAT ") must be less than or " 175 "equal to CMSOldPLABMax (" SIZE_FORMAT ")\n", 176 *value, CMSOldPLABMax); 177 } 178 return Flag::VIOLATES_CONSTRAINT; 179 } else { 180 return Flag::SUCCESS; 181 } 182 } 183 184 Flag::Error CMSPrecleanDenominatorConstraintFunc(bool verbose, uintx* value) { 185 if ((CommandLineFlags::finishedInitializing()) && (*value <= CMSPrecleanNumerator)) { 186 if (verbose == true) { 187 jio_fprintf(defaultStream::error_stream(), 188 "CMSPrecleanDenominator (" UINTX_FORMAT ") must be strickly greater than " 189 "CMSPrecleanNumerator (" UINTX_FORMAT ")\n", 190 *value, CMSPrecleanNumerator); 191 } 192 return Flag::VIOLATES_CONSTRAINT; 193 } else { 194 return Flag::SUCCESS; 195 } 196 } 197 198 Flag::Error CMSPrecleanNumeratorConstraintFunc(bool verbose, uintx* value) { 199 if ((CommandLineFlags::finishedInitializing()) && (*value > (CMSPrecleanDenominator - 1))) { 200 if (verbose == true) { 201 jio_fprintf(defaultStream::error_stream(), 202 "CMSPrecleanNumerator (" UINTX_FORMAT ") must be less than or " 203 "equal to CMSPrecleanDenominator - 1 (" UINTX_FORMAT ")\n", *value, 204 CMSPrecleanDenominator - 1); 205 } 206 return Flag::VIOLATES_CONSTRAINT; 207 } else { 208 return Flag::SUCCESS; 209 } 210 } 211 212 Flag::Error SurvivorAlignmentInBytesConstraintFunc(bool verbose, intx* value) { 213 if (CommandLineFlags::finishedInitializing()) { 214 if (*value != 0) { 215 if (!is_power_of_2(*value)) { 216 if (verbose == true) { 217 jio_fprintf(defaultStream::error_stream(), 218 "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be power of 2\n", 219 *value); 220 } 221 return Flag::VIOLATES_CONSTRAINT; 222 } 223 if (*value < ObjectAlignmentInBytes) { 224 if (verbose == true) { 225 jio_fprintf(defaultStream::error_stream(), 226 "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be greater than or " 227 "equal to ObjectAlignmentInBytes (" INTX_FORMAT ") \n", 228 *value, ObjectAlignmentInBytes); 229 } 230 return Flag::VIOLATES_CONSTRAINT; 231 } 232 } 233 } 234 return Flag::SUCCESS; 235 } | 25 #include "precompiled.hpp" 26 #include "runtime/arguments.hpp" 27 #include "runtime/commandLineFlagConstraintsGC.hpp" 28 #include "runtime/globals.hpp" 29 #include "utilities/defaultStream.hpp" 30 31 #if INCLUDE_ALL_GCS 32 #include "gc/g1/g1_globals.hpp" 33 #endif // INCLUDE_ALL_GCS 34 #ifdef COMPILER1 35 #include "c1/c1_globals.hpp" 36 #endif // COMPILER1 37 #ifdef COMPILER2 38 #include "opto/c2_globals.hpp" 39 #endif // COMPILER2 40 41 Flag::Error MinHeapFreeRatioConstraintFunc(bool verbose, uintx* value) { 42 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxHeapFreeRatio)) { 43 if (verbose == true) { 44 jio_fprintf(defaultStream::error_stream(), 45 "MinHeapFreeRatio ("UINTX_FORMAT") must be less than or " 46 "equal to MaxHeapFreeRatio ("UINTX_FORMAT")\n", 47 *value, MaxHeapFreeRatio); 48 } 49 return Flag::VIOLATES_CONSTRAINT; 50 } else { 51 return Flag::SUCCESS; 52 } 53 } 54 55 Flag::Error MaxHeapFreeRatioConstraintFunc(bool verbose, uintx* value) { 56 if ((CommandLineFlags::finishedInitializing()) && (*value < MinHeapFreeRatio)) { 57 if (verbose == true) { 58 jio_fprintf(defaultStream::error_stream(), 59 "MaxHeapFreeRatio ("UINTX_FORMAT") must be greater than or " 60 "equal to MinHeapFreeRatio ("UINTX_FORMAT")\n", 61 *value, MinHeapFreeRatio); 62 } 63 return Flag::VIOLATES_CONSTRAINT; 64 } else { 65 return Flag::SUCCESS; 66 } 67 } 68 69 Flag::Error MinMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) { 70 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxMetaspaceFreeRatio)) { 71 if (verbose == true) { 72 jio_fprintf(defaultStream::error_stream(), 73 "MinMetaspaceFreeRatio ("UINTX_FORMAT") must be less than or " 74 "equal to MaxMetaspaceFreeRatio ("UINTX_FORMAT")\n", 75 *value, MaxMetaspaceFreeRatio); 76 } 77 return Flag::VIOLATES_CONSTRAINT; 78 } else { 79 return Flag::SUCCESS; 80 } 81 } 82 83 Flag::Error MaxMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) { 84 if ((CommandLineFlags::finishedInitializing()) && (*value < MinMetaspaceFreeRatio)) { 85 if (verbose == true) { 86 jio_fprintf(defaultStream::error_stream(), 87 "MaxMetaspaceFreeRatio ("UINTX_FORMAT") must be greater than or " 88 "equal to MinMetaspaceFreeRatio ("UINTX_FORMAT")\n", 89 *value, MinMetaspaceFreeRatio); 90 } 91 return Flag::VIOLATES_CONSTRAINT; 92 } else { 93 return Flag::SUCCESS; 94 } 95 } 96 97 // GC workaround for "-XX:+UseConcMarkSweepGC" 98 // which sets InitialTenuringThreshold to 7 but leaves MaxTenuringThreshold remaining at 6 99 // and therefore would invalidate the constraint 100 #define UseConcMarkSweepGCWorkaroundIfNeeded(initial, max) \ 101 do { \ 102 if ((initial == 7) && (max == 6)) { \ 103 return Flag::SUCCESS; \ 104 } \ 105 } while (0) 106 107 Flag::Error InitialTenuringThresholdConstraintFunc(bool verbose, uintx* value) { 108 UseConcMarkSweepGCWorkaroundIfNeeded(*value, MaxTenuringThreshold); 109 110 if ((CommandLineFlags::finishedInitializing()) && (*value > MaxTenuringThreshold)) { 111 if (verbose == true) { 112 jio_fprintf(defaultStream::error_stream(), 113 "InitialTenuringThreshold ("UINTX_FORMAT") must be less than or " 114 "equal to MaxTenuringThreshold ("UINTX_FORMAT")\n", 115 *value, MaxTenuringThreshold); 116 } 117 return Flag::VIOLATES_CONSTRAINT; 118 } else { 119 return Flag::SUCCESS; 120 } 121 } 122 123 Flag::Error MaxTenuringThresholdConstraintFunc(bool verbose, uintx* value) { 124 UseConcMarkSweepGCWorkaroundIfNeeded(InitialTenuringThreshold, *value); 125 126 if ((CommandLineFlags::finishedInitializing()) && (*value < InitialTenuringThreshold)) { 127 if (verbose == true) { 128 jio_fprintf(defaultStream::error_stream(), 129 "MaxTenuringThreshold ("UINTX_FORMAT") must be greater than or " 130 "equal to InitialTenuringThreshold ("UINTX_FORMAT")\n", 131 *value, InitialTenuringThreshold); 132 } 133 return Flag::VIOLATES_CONSTRAINT; 134 } else { 135 return Flag::SUCCESS; 136 } 137 } 138 139 #if INCLUDE_ALL_GCS 140 141 Flag::Error G1NewSizePercentConstraintFunc(bool verbose, uintx* value) { 142 if ((CommandLineFlags::finishedInitializing()) && (*value > G1MaxNewSizePercent)) { 143 if (verbose == true) { 144 jio_fprintf(defaultStream::error_stream(), 145 "G1NewSizePercent ("UINTX_FORMAT") must be less than or " 146 "equal to G1MaxNewSizePercent ("UINTX_FORMAT")\n", 147 *value, G1MaxNewSizePercent); 148 } 149 return Flag::VIOLATES_CONSTRAINT; 150 } else { 151 return Flag::SUCCESS; 152 } 153 } 154 155 Flag::Error G1MaxNewSizePercentConstraintFunc(bool verbose, uintx* value) { 156 if ((CommandLineFlags::finishedInitializing()) && (*value < G1NewSizePercent)) { 157 if (verbose == true) { 158 jio_fprintf(defaultStream::error_stream(), 159 "G1MaxNewSizePercent ("UINTX_FORMAT") must be greater than or " 160 "equal to G1NewSizePercent ("UINTX_FORMAT")\n", 161 *value, G1NewSizePercent); 162 } 163 return Flag::VIOLATES_CONSTRAINT; 164 } else { 165 return Flag::SUCCESS; 166 } 167 } 168 169 #endif // INCLUDE_ALL_GCS 170 171 Flag::Error CMSOldPLABMinConstraintFunc(bool verbose, size_t* value) { 172 if ((CommandLineFlags::finishedInitializing()) && (*value > CMSOldPLABMax)) { 173 if (verbose == true) { 174 jio_fprintf(defaultStream::error_stream(), 175 "CMSOldPLABMin ("SIZE_FORMAT") must be less than or " 176 "equal to CMSOldPLABMax ("SIZE_FORMAT")\n", 177 *value, CMSOldPLABMax); 178 } 179 return Flag::VIOLATES_CONSTRAINT; 180 } else { 181 return Flag::SUCCESS; 182 } 183 } 184 185 Flag::Error CMSPrecleanDenominatorConstraintFunc(bool verbose, uintx* value) { 186 if ((CommandLineFlags::finishedInitializing()) && (*value <= CMSPrecleanNumerator)) { 187 if (verbose == true) { 188 jio_fprintf(defaultStream::error_stream(), 189 "CMSPrecleanDenominator ("UINTX_FORMAT") must be strickly greater than " 190 "CMSPrecleanNumerator ("UINTX_FORMAT")\n", 191 *value, CMSPrecleanNumerator); 192 } 193 return Flag::VIOLATES_CONSTRAINT; 194 } else { 195 return Flag::SUCCESS; 196 } 197 } 198 199 Flag::Error CMSPrecleanNumeratorConstraintFunc(bool verbose, uintx* value) { 200 if ((CommandLineFlags::finishedInitializing()) && (*value > (CMSPrecleanDenominator - 1))) { 201 if (verbose == true) { 202 jio_fprintf(defaultStream::error_stream(), 203 "CMSPrecleanNumerator ("UINTX_FORMAT") must be less than or " 204 "equal to CMSPrecleanDenominator - 1 ("UINTX_FORMAT")\n", *value, 205 CMSPrecleanDenominator - 1); 206 } 207 return Flag::VIOLATES_CONSTRAINT; 208 } else { 209 return Flag::SUCCESS; 210 } 211 } 212 213 Flag::Error SurvivorAlignmentInBytesConstraintFunc(bool verbose, intx* value) { 214 if (CommandLineFlags::finishedInitializing()) { 215 if (*value != 0) { 216 if (!is_power_of_2(*value)) { 217 if (verbose == true) { 218 jio_fprintf(defaultStream::error_stream(), 219 "SurvivorAlignmentInBytes ("INTX_FORMAT") must be power of 2\n", 220 *value); 221 } 222 return Flag::VIOLATES_CONSTRAINT; 223 } 224 if (*value < ObjectAlignmentInBytes) { 225 if (verbose == true) { 226 jio_fprintf(defaultStream::error_stream(), 227 "SurvivorAlignmentInBytes ("INTX_FORMAT") must be greater than or " 228 "equal to ObjectAlignmentInBytes ("INTX_FORMAT") \n", 229 *value, ObjectAlignmentInBytes); 230 } 231 return Flag::VIOLATES_CONSTRAINT; 232 } 233 } 234 } 235 return Flag::SUCCESS; 236 } |