< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page




3268   }
3269 }
3270 
3271 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
3272   // We can safely ignore accessors here, since c2 will inline them anyway,
3273   // accessors are also always mature.
3274   if (!x->inlinee()->is_accessor()) {
3275     CodeEmitInfo* info = state_for(x, x->state(), true);
3276     // Notify the runtime very infrequently only to take care of counter overflows
3277     int freq_log = Tier23InlineeNotifyFreqLog;
3278     double scale;
3279     if (_method->has_option_value("CompileThresholdScaling", scale)) {
3280       freq_log = CompilerConfig::scaled_freq_log(freq_log, scale);
3281     }
3282     increment_event_counter_impl(info, x->inlinee(), LIR_OprFact::intConst(InvocationCounter::count_increment), right_n_bits(freq_log), InvocationEntryBci, false, true);
3283   }
3284 }
3285 
3286 void LIRGenerator::increment_backedge_counter_conditionally(LIR_Condition cond, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info, int left_bci, int right_bci, int bci) {
3287   if (compilation()->count_backedges()) {





3288     __ cmp(cond, left, right);

3289     LIR_Opr step = new_register(T_INT);
3290     LIR_Opr plus_one = LIR_OprFact::intConst(InvocationCounter::count_increment);
3291     LIR_Opr zero = LIR_OprFact::intConst(0);
3292     __ cmove(cond,
3293         (left_bci < bci) ? plus_one : zero,
3294         (right_bci < bci) ? plus_one : zero,
3295         step, left->type());
3296     increment_backedge_counter(info, step, bci);
3297   }
3298 }
3299 
3300 
3301 void LIRGenerator::increment_event_counter(CodeEmitInfo* info, LIR_Opr step, int bci, bool backedge) {
3302   int freq_log = 0;
3303   int level = compilation()->env()->comp_level();
3304   if (level == CompLevel_limited_profile) {
3305     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3306   } else if (level == CompLevel_full_profile) {
3307     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3308   } else {




3268   }
3269 }
3270 
3271 void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
3272   // We can safely ignore accessors here, since c2 will inline them anyway,
3273   // accessors are also always mature.
3274   if (!x->inlinee()->is_accessor()) {
3275     CodeEmitInfo* info = state_for(x, x->state(), true);
3276     // Notify the runtime very infrequently only to take care of counter overflows
3277     int freq_log = Tier23InlineeNotifyFreqLog;
3278     double scale;
3279     if (_method->has_option_value("CompileThresholdScaling", scale)) {
3280       freq_log = CompilerConfig::scaled_freq_log(freq_log, scale);
3281     }
3282     increment_event_counter_impl(info, x->inlinee(), LIR_OprFact::intConst(InvocationCounter::count_increment), right_n_bits(freq_log), InvocationEntryBci, false, true);
3283   }
3284 }
3285 
3286 void LIRGenerator::increment_backedge_counter_conditionally(LIR_Condition cond, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info, int left_bci, int right_bci, int bci) {
3287   if (compilation()->count_backedges()) {
3288 #ifndef _LP64
3289     LIR_Opr left_copy = new_register(left->type());
3290     __ move(left, left_copy);
3291     __ cmp(cond, left_copy, right);
3292 #else
3293     __ cmp(cond, left, right);
3294 #endif
3295     LIR_Opr step = new_register(T_INT);
3296     LIR_Opr plus_one = LIR_OprFact::intConst(InvocationCounter::count_increment);
3297     LIR_Opr zero = LIR_OprFact::intConst(0);
3298     __ cmove(cond,
3299         (left_bci < bci) ? plus_one : zero,
3300         (right_bci < bci) ? plus_one : zero,
3301         step, left->type());
3302     increment_backedge_counter(info, step, bci);
3303   }
3304 }
3305 
3306 
3307 void LIRGenerator::increment_event_counter(CodeEmitInfo* info, LIR_Opr step, int bci, bool backedge) {
3308   int freq_log = 0;
3309   int level = compilation()->env()->comp_level();
3310   if (level == CompLevel_limited_profile) {
3311     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3312   } else if (level == CompLevel_full_profile) {
3313     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3314   } else {


< prev index next >