src/share/vm/c1/c1_LIRGenerator.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/c1

src/share/vm/c1/c1_LIRGenerator.cpp

Print this page
rev 8995 : 8046155: JEP165: Compiler Control
Summary:
Reviewed-by:


3323                                 ret->type(), x->ret(), mdp,
3324                                 !x->needs_null_check(),
3325                                 signature_at_call->return_type()->as_klass(),
3326                                 x->callee()->signature()->return_type()->as_klass());
3327   if (exact != NULL) {
3328     md->set_return_type(bci, exact);
3329   }
3330 }
3331 
3332 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
3333   // We can safely ignore accessors here, since c2 will inline them anyway,
3334   // accessors are also always mature.
3335   if (!x->inlinee()->is_accessor()) {
3336     CodeEmitInfo* info = state_for(x, x->state(), true);
3337     // Notify the runtime very infrequently only to take care of counter overflows
3338     int freq_log = Tier23InlineeNotifyFreqLog;
3339     double scale;
3340     if (_method->has_option_value("CompileThresholdScaling", scale)) {
3341       freq_log = Arguments::scaled_freq_log(freq_log, scale);
3342     }
3343     increment_event_counter_impl(info, x->inlinee(), right_n_bits(freq_log), InvocationEntryBci, false, true);
3344   }
3345 }
3346 
3347 void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool backedge) {
3348   int freq_log;
3349   int level = compilation()->env()->comp_level();
3350   if (level == CompLevel_limited_profile) {
3351     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3352   } else if (level == CompLevel_full_profile) {
3353     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3354   } else {
3355     ShouldNotReachHere();
3356   }
3357   // Increment the appropriate invocation/backedge counter and notify the runtime.
3358   double scale;
3359   if (_method->has_option_value("CompileThresholdScaling", scale)) {
3360     freq_log = Arguments::scaled_freq_log(freq_log, scale);
3361   }
3362   increment_event_counter_impl(info, info->scope()->method(), right_n_bits(freq_log), bci, backedge, true);

3363 }
3364 
3365 void LIRGenerator::decrement_age(CodeEmitInfo* info) {
3366   ciMethod* method = info->scope()->method();
3367   MethodCounters* mc_adr = method->ensure_method_counters();
3368   if (mc_adr != NULL) {
3369     LIR_Opr mc = new_pointer_register();
3370     __ move(LIR_OprFact::intptrConst(mc_adr), mc);
3371     int offset = in_bytes(MethodCounters::nmethod_age_offset());
3372     LIR_Address* counter = new LIR_Address(mc, offset, T_INT);
3373     LIR_Opr result = new_register(T_INT);
3374     __ load(counter, result);
3375     __ sub(result, LIR_OprFact::intConst(1), result);
3376     __ store(result, counter);
3377     // DeoptimizeStub will reexecute from the current state in code info.
3378     CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured,
3379                                          Deoptimization::Action_make_not_entrant);
3380     __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0));
3381     __ branch(lir_cond_lessEqual, T_INT, deopt);
3382   }




3323                                 ret->type(), x->ret(), mdp,
3324                                 !x->needs_null_check(),
3325                                 signature_at_call->return_type()->as_klass(),
3326                                 x->callee()->signature()->return_type()->as_klass());
3327   if (exact != NULL) {
3328     md->set_return_type(bci, exact);
3329   }
3330 }
3331 
3332 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
3333   // We can safely ignore accessors here, since c2 will inline them anyway,
3334   // accessors are also always mature.
3335   if (!x->inlinee()->is_accessor()) {
3336     CodeEmitInfo* info = state_for(x, x->state(), true);
3337     // Notify the runtime very infrequently only to take care of counter overflows
3338     int freq_log = Tier23InlineeNotifyFreqLog;
3339     double scale;
3340     if (_method->has_option_value("CompileThresholdScaling", scale)) {
3341       freq_log = Arguments::scaled_freq_log(freq_log, scale);
3342     }

3343   }
3344 }
3345 
3346 void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool backedge) {
3347   int freq_log;
3348   int level = compilation()->env()->comp_level();
3349   if (level == CompLevel_limited_profile) {
3350     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3351   } else if (level == CompLevel_full_profile) {
3352     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3353   } else {
3354     ShouldNotReachHere();
3355   }
3356   // Increment the appropriate invocation/backedge counter and notify the runtime.
3357   double scale;
3358   if (_method->has_option_value("CompileThresholdScaling", scale)) {
3359     freq_log = Arguments::scaled_freq_log(freq_log, scale);

3360     increment_event_counter_impl(info, info->scope()->method(), right_n_bits(freq_log), bci, backedge, true);
3361   }
3362 }
3363 
3364 void LIRGenerator::decrement_age(CodeEmitInfo* info) {
3365   ciMethod* method = info->scope()->method();
3366   MethodCounters* mc_adr = method->ensure_method_counters();
3367   if (mc_adr != NULL) {
3368     LIR_Opr mc = new_pointer_register();
3369     __ move(LIR_OprFact::intptrConst(mc_adr), mc);
3370     int offset = in_bytes(MethodCounters::nmethod_age_offset());
3371     LIR_Address* counter = new LIR_Address(mc, offset, T_INT);
3372     LIR_Opr result = new_register(T_INT);
3373     __ load(counter, result);
3374     __ sub(result, LIR_OprFact::intConst(1), result);
3375     __ store(result, counter);
3376     // DeoptimizeStub will reexecute from the current state in code info.
3377     CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured,
3378                                          Deoptimization::Action_make_not_entrant);
3379     __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0));
3380     __ branch(lir_cond_lessEqual, T_INT, deopt);
3381   }


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