hotspot/src/share/vm/interpreter/invocationCounter.cpp
void InvocationCounter::reinitialize(bool delay_overflow) {
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
// define states
guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits");
{- -------------------------------------------
(1) ... #TODO (def() 参照)
---------------------------------------- -}
def(wait_for_nothing, 0, do_nothing);
if (delay_overflow) {
def(wait_for_compile, 0, do_decay);
} else {
def(wait_for_compile, 0, dummy_invocation_counter_overflow);
}
{- -------------------------------------------
(1) InvocationCounter 関係の定数値を初期化する. セットするのは以下の3つ.
* InvocationCounter::InterpreterInvocationLimit
* InvocationCounter::InterpreterBackwardBranchLimit
* InvocationCounter::InterpreterProfileLimit
(See: InvocationCounter)
(See: InterpreterGenerator::generate_counter_incr(), TemplateTable::branch())
---------------------------------------- -}
InterpreterInvocationLimit = CompileThreshold << number_of_noncount_bits;
InterpreterProfileLimit = ((CompileThreshold * InterpreterProfilePercentage) / 100)<< number_of_noncount_bits;
// When methodData is collected, the backward branch limit is compared against a
// methodData counter, rather than an InvocationCounter. In the former case, we
// don't need the shift by number_of_noncount_bits, but we do need to adjust
// the factor by which we scale the threshold.
if (ProfileInterpreter) {
InterpreterBackwardBranchLimit = (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100;
} else {
InterpreterBackwardBranchLimit = ((CompileThreshold * OnStackReplacePercentage) / 100) << number_of_noncount_bits;
}
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(0 <= InterpreterBackwardBranchLimit,
"OSR threshold should be non-negative");
assert(0 <= InterpreterProfileLimit &&
InterpreterProfileLimit <= InterpreterInvocationLimit,
"profile threshold should be less than the compilation threshold "
"and non-negative");
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.