128 return JVMFlag::VIOLATES_CONSTRAINT; 129 } 130 131 return JVMFlag::SUCCESS; 132 } 133 134 JVMFlag::Error CompileThresholdConstraintFunc(intx value, bool verbose) { 135 if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) { 136 JVMFlag::printError(verbose, 137 "CompileThreshold (" INTX_FORMAT ") " 138 "must be between 0 and %d\n", 139 value, 140 INT_MAX >> InvocationCounter::count_shift); 141 return JVMFlag::VIOLATES_CONSTRAINT; 142 } 143 144 return JVMFlag::SUCCESS; 145 } 146 147 JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) { 148 int backward_branch_limit; 149 if (ProfileInterpreter) { 150 if (OnStackReplacePercentage < InterpreterProfilePercentage) { 151 JVMFlag::printError(verbose, 152 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 153 "larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n", 154 OnStackReplacePercentage, InterpreterProfilePercentage); 155 return JVMFlag::VIOLATES_CONSTRAINT; 156 } 157 158 backward_branch_limit = ((CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100) 159 << InvocationCounter::count_shift; 160 161 if (backward_branch_limit < 0) { 162 JVMFlag::printError(verbose, 163 "CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = " 164 INTX_FORMAT " " 165 "must be between 0 and %d, try changing " 166 "CompileThreshold, InterpreterProfilePercentage, and/or OnStackReplacePercentage\n", 167 (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100, 168 INT_MAX >> InvocationCounter::count_shift); 169 return JVMFlag::VIOLATES_CONSTRAINT; 170 } 171 } else { 172 if (OnStackReplacePercentage < 0 ) { 173 JVMFlag::printError(verbose, 174 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 175 "non-negative\n", OnStackReplacePercentage); 176 return JVMFlag::VIOLATES_CONSTRAINT; 177 } 178 179 backward_branch_limit = ((CompileThreshold * OnStackReplacePercentage) / 100) 180 << InvocationCounter::count_shift; 181 182 if (backward_branch_limit < 0) { 183 JVMFlag::printError(verbose, 184 "CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " " 185 "must be between 0 and %d, try changing " 186 "CompileThreshold and/or OnStackReplacePercentage\n", 187 (CompileThreshold * OnStackReplacePercentage) / 100, 188 INT_MAX >> InvocationCounter::count_shift); 189 return JVMFlag::VIOLATES_CONSTRAINT; 190 } 191 } 192 return JVMFlag::SUCCESS; 193 } 194 195 JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { 196 if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) { 197 JVMFlag::printError(verbose, 198 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 199 "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") " 200 "to align entry points\n", 201 CodeCacheSegmentSize, CodeEntryAlignment); 202 return JVMFlag::VIOLATES_CONSTRAINT; 203 } 204 205 if (CodeCacheSegmentSize < sizeof(jdouble)) { 206 JVMFlag::printError(verbose, 207 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 208 "at least " SIZE_FORMAT " to align constants\n", | 128 return JVMFlag::VIOLATES_CONSTRAINT; 129 } 130 131 return JVMFlag::SUCCESS; 132 } 133 134 JVMFlag::Error CompileThresholdConstraintFunc(intx value, bool verbose) { 135 if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) { 136 JVMFlag::printError(verbose, 137 "CompileThreshold (" INTX_FORMAT ") " 138 "must be between 0 and %d\n", 139 value, 140 INT_MAX >> InvocationCounter::count_shift); 141 return JVMFlag::VIOLATES_CONSTRAINT; 142 } 143 144 return JVMFlag::SUCCESS; 145 } 146 147 JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) { 148 int64_t max_percentage_limit = INT_MAX; 149 if (!ProfileInterpreter) { 150 max_percentage_limit = (max_percentage_limit>>InvocationCounter::count_shift); 151 } 152 max_percentage_limit = CompileThreshold == 0 ? max_percentage_limit*100 : max_percentage_limit*100/CompileThreshold; 153 154 if (ProfileInterpreter) { 155 if (value < InterpreterProfilePercentage) { 156 JVMFlag::printError(verbose, 157 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 158 "larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n", 159 value, InterpreterProfilePercentage); 160 return JVMFlag::VIOLATES_CONSTRAINT; 161 } 162 163 max_percentage_limit += InterpreterProfilePercentage; 164 if (value > max_percentage_limit) { 165 JVMFlag::printError(verbose, 166 "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", 167 value, 168 max_percentage_limit); 169 return JVMFlag::VIOLATES_CONSTRAINT; 170 } 171 } else { 172 if (value < 0) { 173 JVMFlag::printError(verbose, 174 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 175 "non-negative\n", value); 176 return JVMFlag::VIOLATES_CONSTRAINT; 177 } 178 179 if (value > max_percentage_limit) { 180 JVMFlag::printError(verbose, 181 "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", 182 value, 183 max_percentage_limit); 184 return JVMFlag::VIOLATES_CONSTRAINT; 185 } 186 } 187 return JVMFlag::SUCCESS; 188 } 189 190 JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { 191 if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) { 192 JVMFlag::printError(verbose, 193 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 194 "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") " 195 "to align entry points\n", 196 CodeCacheSegmentSize, CodeEntryAlignment); 197 return JVMFlag::VIOLATES_CONSTRAINT; 198 } 199 200 if (CodeCacheSegmentSize < sizeof(jdouble)) { 201 JVMFlag::printError(verbose, 202 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 203 "at least " SIZE_FORMAT " to align constants\n", |