136 } 137 138 void InvocationCounter::reinitialize(bool delay_overflow) { 139 // define states 140 guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits"); 141 def(wait_for_nothing, 0, do_nothing); 142 if (delay_overflow) { 143 def(wait_for_compile, 0, do_decay); 144 } else { 145 def(wait_for_compile, 0, dummy_invocation_counter_overflow); 146 } 147 148 InterpreterInvocationLimit = CompileThreshold << number_of_noncount_bits; 149 InterpreterProfileLimit = ((CompileThreshold * InterpreterProfilePercentage) / 100)<< number_of_noncount_bits; 150 151 // When methodData is collected, the backward branch limit is compared against a 152 // methodData counter, rather than an InvocationCounter. In the former case, we 153 // don't need the shift by number_of_noncount_bits, but we do need to adjust 154 // the factor by which we scale the threshold. 155 if (ProfileInterpreter) { 156 InterpreterBackwardBranchLimit = (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100; 157 } else { 158 InterpreterBackwardBranchLimit = ((CompileThreshold * OnStackReplacePercentage) / 100) << number_of_noncount_bits; 159 } 160 161 assert(0 <= InterpreterBackwardBranchLimit, 162 "OSR threshold should be non-negative"); 163 assert(0 <= InterpreterProfileLimit && 164 InterpreterProfileLimit <= InterpreterInvocationLimit, 165 "profile threshold should be less than the compilation threshold " 166 "and non-negative"); 167 } 168 169 void invocationCounter_init() { 170 InvocationCounter::reinitialize(DelayCompilationDuringStartup); 171 } | 136 } 137 138 void InvocationCounter::reinitialize(bool delay_overflow) { 139 // define states 140 guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits"); 141 def(wait_for_nothing, 0, do_nothing); 142 if (delay_overflow) { 143 def(wait_for_compile, 0, do_decay); 144 } else { 145 def(wait_for_compile, 0, dummy_invocation_counter_overflow); 146 } 147 148 InterpreterInvocationLimit = CompileThreshold << number_of_noncount_bits; 149 InterpreterProfileLimit = ((CompileThreshold * InterpreterProfilePercentage) / 100)<< number_of_noncount_bits; 150 151 // When methodData is collected, the backward branch limit is compared against a 152 // methodData counter, rather than an InvocationCounter. In the former case, we 153 // don't need the shift by number_of_noncount_bits, but we do need to adjust 154 // the factor by which we scale the threshold. 155 if (ProfileInterpreter) { 156 InterpreterBackwardBranchLimit = ((int64_t)CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100; 157 } else { 158 InterpreterBackwardBranchLimit = (((int64_t)CompileThreshold * OnStackReplacePercentage) / 100) << number_of_noncount_bits; 159 } 160 161 assert(0 <= InterpreterBackwardBranchLimit, 162 "OSR threshold should be non-negative"); 163 assert(0 <= InterpreterProfileLimit && 164 InterpreterProfileLimit <= InterpreterInvocationLimit, 165 "profile threshold should be less than the compilation threshold " 166 "and non-negative"); 167 } 168 169 void invocationCounter_init() { 170 InvocationCounter::reinitialize(DelayCompilationDuringStartup); 171 } |