< prev index next >

src/share/vm/interpreter/invocationCounter.cpp

Print this page




  87   switch (state) {
  88     case wait_for_nothing            : return "wait_for_nothing";
  89     case wait_for_compile            : return "wait_for_compile";
  90     default:
  91       ShouldNotReachHere();
  92       return NULL;
  93   }
  94 }
  95 
  96 const char* InvocationCounter::state_as_short_string(State state) {
  97   switch (state) {
  98     case wait_for_nothing            : return "not comp.";
  99     case wait_for_compile            : return "compileable";
 100     default:
 101       ShouldNotReachHere();
 102       return NULL;
 103   }
 104 }
 105 
 106 
 107 static address do_nothing(methodHandle method, TRAPS) {
 108   // dummy action for inactive invocation counters
 109   MethodCounters* mcs = method->method_counters();
 110   assert(mcs != NULL, "");
 111   mcs->invocation_counter()->set_carry();
 112   mcs->invocation_counter()->set_state(InvocationCounter::wait_for_nothing);
 113   return NULL;
 114 }
 115 
 116 
 117 static address do_decay(methodHandle method, TRAPS) {
 118   // decay invocation counters so compilation gets delayed
 119   MethodCounters* mcs = method->method_counters();
 120   assert(mcs != NULL, "");
 121   mcs->invocation_counter()->decay();
 122   return NULL;
 123 }
 124 
 125 
 126 void InvocationCounter::def(State state, int init, Action action) {
 127   assert(0 <= state && state < number_of_states, "illegal state");
 128   assert(0 <= init  && init  < count_limit, "initial value out of range");
 129   _init  [state] = init;
 130   _action[state] = action;
 131 }
 132 
 133 address dummy_invocation_counter_overflow(methodHandle m, TRAPS) {
 134   ShouldNotReachHere();
 135   return NULL;
 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


  87   switch (state) {
  88     case wait_for_nothing            : return "wait_for_nothing";
  89     case wait_for_compile            : return "wait_for_compile";
  90     default:
  91       ShouldNotReachHere();
  92       return NULL;
  93   }
  94 }
  95 
  96 const char* InvocationCounter::state_as_short_string(State state) {
  97   switch (state) {
  98     case wait_for_nothing            : return "not comp.";
  99     case wait_for_compile            : return "compileable";
 100     default:
 101       ShouldNotReachHere();
 102       return NULL;
 103   }
 104 }
 105 
 106 
 107 static address do_nothing(const methodHandle& method, TRAPS) {
 108   // dummy action for inactive invocation counters
 109   MethodCounters* mcs = method->method_counters();
 110   assert(mcs != NULL, "");
 111   mcs->invocation_counter()->set_carry();
 112   mcs->invocation_counter()->set_state(InvocationCounter::wait_for_nothing);
 113   return NULL;
 114 }
 115 
 116 
 117 static address do_decay(const methodHandle& method, TRAPS) {
 118   // decay invocation counters so compilation gets delayed
 119   MethodCounters* mcs = method->method_counters();
 120   assert(mcs != NULL, "");
 121   mcs->invocation_counter()->decay();
 122   return NULL;
 123 }
 124 
 125 
 126 void InvocationCounter::def(State state, int init, Action action) {
 127   assert(0 <= state && state < number_of_states, "illegal state");
 128   assert(0 <= init  && init  < count_limit, "initial value out of range");
 129   _init  [state] = init;
 130   _action[state] = action;
 131 }
 132 
 133 address dummy_invocation_counter_overflow(const methodHandle& m, TRAPS) {
 134   ShouldNotReachHere();
 135   return NULL;
 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
< prev index next >