src/hotspot/share/interpreter/invocationCounter.cpp
changeset 53571 3997614d4834
parent 53546 63eb7e38ce84
equal deleted inserted replaced
53570:ab7fcc43dab4 53571:3997614d4834
    77 // Initialization
    77 // Initialization
    78 
    78 
    79 int                       InvocationCounter::_init  [InvocationCounter::number_of_states];
    79 int                       InvocationCounter::_init  [InvocationCounter::number_of_states];
    80 InvocationCounter::Action InvocationCounter::_action[InvocationCounter::number_of_states];
    80 InvocationCounter::Action InvocationCounter::_action[InvocationCounter::number_of_states];
    81 
    81 
       
    82 #ifdef CC_INTERP
       
    83 int                       InvocationCounter::InterpreterInvocationLimit;
       
    84 int                       InvocationCounter::InterpreterBackwardBranchLimit;
       
    85 #endif
    82 
    86 
    83 const char* InvocationCounter::state_as_string(State state) {
    87 const char* InvocationCounter::state_as_string(State state) {
    84   switch (state) {
    88   switch (state) {
    85     case wait_for_nothing            : return "wait_for_nothing";
    89     case wait_for_nothing            : return "wait_for_nothing";
    86     case wait_for_compile            : return "wait_for_compile";
    90     case wait_for_compile            : return "wait_for_compile";
   130 void InvocationCounter::reinitialize() {
   134 void InvocationCounter::reinitialize() {
   131   // define states
   135   // define states
   132   guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits");
   136   guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits");
   133   def(wait_for_nothing, 0, do_nothing);
   137   def(wait_for_nothing, 0, do_nothing);
   134   def(wait_for_compile, 0, do_decay);
   138   def(wait_for_compile, 0, do_decay);
       
   139 
       
   140 #ifdef CC_INTERP
       
   141   InterpreterInvocationLimit = CompileThreshold << number_of_noncount_bits;
       
   142 
       
   143   // When methodData is collected, the backward branch limit is compared against a
       
   144   // methodData counter, rather than an InvocationCounter.  In the former case, we
       
   145   // don't need the shift by number_of_noncount_bits, but we do need to adjust
       
   146   // the factor by which we scale the threshold.
       
   147   if (ProfileInterpreter) {
       
   148     InterpreterBackwardBranchLimit = (int)((int64_t)CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
       
   149   } else {
       
   150     InterpreterBackwardBranchLimit = (int)(((int64_t)CompileThreshold * OnStackReplacePercentage / 100) << number_of_noncount_bits);
       
   151   }
       
   152 
       
   153   assert(0 <= InterpreterBackwardBranchLimit, "OSR threshold should be non-negative");
       
   154 #endif
   135 }
   155 }
   136 
   156 
   137 void invocationCounter_init() {
   157 void invocationCounter_init() {
   138   InvocationCounter::reinitialize();
   158   InvocationCounter::reinitialize();
   139 }
   159 }