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 = ((int64_t)INT_MAX>>InvocationCounter::count_shift)*100; 149 max_percentage_limit = CompileThreshold == 0 ? max_percentage_limit : max_percentage_limit/CompileThreshold; 150 151 if (ProfileInterpreter) { 152 if (value < InterpreterProfilePercentage) { 153 JVMFlag::printError(verbose, 154 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 155 "larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n", 156 value, InterpreterProfilePercentage); 157 return JVMFlag::VIOLATES_CONSTRAINT; 158 } 159 160 max_percentage_limit += InterpreterProfilePercentage; 161 if (value > max_percentage_limit) { 162 JVMFlag::printError(verbose, 163 "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", 164 value, 165 max_percentage_limit); 166 return JVMFlag::VIOLATES_CONSTRAINT; 167 } 168 } else { 169 if (value < 0) { 170 JVMFlag::printError(verbose, 171 "OnStackReplacePercentage (" INTX_FORMAT ") must be " 172 "non-negative\n", value); 173 return JVMFlag::VIOLATES_CONSTRAINT; 174 } 175 176 if (value > max_percentage_limit) { 177 JVMFlag::printError(verbose, 178 "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", 179 value, 180 max_percentage_limit); 181 return JVMFlag::VIOLATES_CONSTRAINT; 182 } 183 } 184 return JVMFlag::SUCCESS; 185 } 186 187 JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { 188 if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) { 189 JVMFlag::printError(verbose, 190 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 191 "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") " 192 "to align entry points\n", 193 CodeCacheSegmentSize, CodeEntryAlignment); 194 return JVMFlag::VIOLATES_CONSTRAINT; 195 } 196 197 if (CodeCacheSegmentSize < sizeof(jdouble)) { 198 JVMFlag::printError(verbose, 199 "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " 200 "at least " SIZE_FORMAT " to align constants\n", |