src/share/vm/runtime/simpleThresholdPolicy.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-comp Sdiff src/share/vm/runtime

src/share/vm/runtime/simpleThresholdPolicy.cpp

Print this page
rev 7045 : 7115356: assert(!m->was_never_executed()) failed
Summary: Race when asserting on invocation counters
Reviewed-by:


 129     if (mh->queued_for_compilation()) {
 130       tty->print("in-queue");
 131     } else tty->print("idle");
 132   }
 133   tty->print_cr("]");
 134 }
 135 
 136 void SimpleThresholdPolicy::initialize() {
 137   if (FLAG_IS_DEFAULT(CICompilerCount)) {
 138     FLAG_SET_DEFAULT(CICompilerCount, 3);
 139   }
 140   int count = CICompilerCount;
 141   if (CICompilerCountPerCPU) {
 142     count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2;
 143   }
 144   set_c1_count(MAX2(count / 3, 1));
 145   set_c2_count(MAX2(count - c1_count(), 1));
 146   FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
 147 }
 148 
 149 void SimpleThresholdPolicy::set_carry_if_necessary(InvocationCounter *counter) {
 150   if (!counter->carry() && counter->count() > InvocationCounter::count_limit / 2) {
 151     counter->set_carry_flag();
 152   }
 153 }
 154 
 155 // Set carry flags on the counters if necessary
 156 void SimpleThresholdPolicy::handle_counter_overflow(Method* method) {
 157   MethodCounters *mcs = method->method_counters();
 158   if (mcs != NULL) {
 159     set_carry_if_necessary(mcs->invocation_counter());
 160     set_carry_if_necessary(mcs->backedge_counter());
 161   }
 162   MethodData* mdo = method->method_data();
 163   if (mdo != NULL) {
 164     set_carry_if_necessary(mdo->invocation_counter());
 165     set_carry_if_necessary(mdo->backedge_counter());
 166   }
 167 }
 168 
 169 // Called with the queue locked and with at least one element
 170 CompileTask* SimpleThresholdPolicy::select_task(CompileQueue* compile_queue) {
 171   return compile_queue->first();
 172 }
 173 
 174 void SimpleThresholdPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
 175   for (ScopeDesc* sd = trap_scope;; sd = sd->sender()) {
 176     if (PrintTieredEvents) {
 177       methodHandle mh(sd->method());
 178       print_event(REPROFILE, mh, mh, InvocationEntryBci, CompLevel_none);
 179     }
 180     MethodData* mdo = sd->method()->method_data();
 181     if (mdo != NULL) {
 182       mdo->reset_start_counters();
 183     }
 184     if (sd->is_top()) break;
 185   }




 129     if (mh->queued_for_compilation()) {
 130       tty->print("in-queue");
 131     } else tty->print("idle");
 132   }
 133   tty->print_cr("]");
 134 }
 135 
 136 void SimpleThresholdPolicy::initialize() {
 137   if (FLAG_IS_DEFAULT(CICompilerCount)) {
 138     FLAG_SET_DEFAULT(CICompilerCount, 3);
 139   }
 140   int count = CICompilerCount;
 141   if (CICompilerCountPerCPU) {
 142     count = MAX2(log2_intptr(os::active_processor_count()), 1) * 3 / 2;
 143   }
 144   set_c1_count(MAX2(count / 3, 1));
 145   set_c2_count(MAX2(count - c1_count(), 1));
 146   FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
 147 }
 148 






 149 // Set carry flags on the counters if necessary
 150 void SimpleThresholdPolicy::handle_counter_overflow(Method* method) {
 151   MethodCounters *mcs = method->method_counters();
 152   if (mcs != NULL) {
 153     mcs->invocation_counter()->set_carry_if_necessary();
 154     mcs->backedge_counter()->set_carry_if_necessary();
 155   }
 156   MethodData* mdo = method->method_data();
 157   if (mdo != NULL) {
 158     mdo->invocation_counter()->set_carry_if_necessary();
 159     mdo->backedge_counter()->set_carry_if_necessary();
 160   }
 161 }
 162 
 163 // Called with the queue locked and with at least one element
 164 CompileTask* SimpleThresholdPolicy::select_task(CompileQueue* compile_queue) {
 165   return compile_queue->first();
 166 }
 167 
 168 void SimpleThresholdPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
 169   for (ScopeDesc* sd = trap_scope;; sd = sd->sender()) {
 170     if (PrintTieredEvents) {
 171       methodHandle mh(sd->method());
 172       print_event(REPROFILE, mh, mh, InvocationEntryBci, CompLevel_none);
 173     }
 174     MethodData* mdo = sd->method()->method_data();
 175     if (mdo != NULL) {
 176       mdo->reset_start_counters();
 177     }
 178     if (sd->is_top()) break;
 179   }


src/share/vm/runtime/simpleThresholdPolicy.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File