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

src/share/vm/c1/c1_LIRGenerator.cpp

Print this page




3036     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3037   } else if (level == CompLevel_full_profile) {
3038     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3039   } else {
3040     ShouldNotReachHere();
3041   }
3042   // Increment the appropriate invocation/backedge counter and notify the runtime.
3043   increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
3044 }
3045 
3046 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
3047                                                 ciMethod *method, int frequency,
3048                                                 int bci, bool backedge, bool notify) {
3049   assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0");
3050   int level = _compilation->env()->comp_level();
3051   assert(level > CompLevel_simple, "Shouldn't be here");
3052 
3053   int offset = -1;
3054   LIR_Opr counter_holder;
3055   if (level == CompLevel_limited_profile) {
3056     address counters_adr = method->ensure_method_counters();




3057     counter_holder = new_pointer_register();
3058     __ move(LIR_OprFact::intptrConst(counters_adr), counter_holder);
3059     offset = in_bytes(backedge ? MethodCounters::backedge_counter_offset() :
3060                                  MethodCounters::invocation_counter_offset());
3061   } else if (level == CompLevel_full_profile) {
3062     counter_holder = new_register(T_METADATA);
3063     offset = in_bytes(backedge ? MethodData::backedge_counter_offset() :
3064                                  MethodData::invocation_counter_offset());
3065     ciMethodData* md = method->method_data_or_null();
3066     assert(md != NULL, "Sanity");
3067     __ metadata2reg(md->constant_encoding(), counter_holder);
3068   } else {
3069     ShouldNotReachHere();
3070   }
3071   LIR_Address* counter = new LIR_Address(counter_holder, offset, T_INT);
3072   LIR_Opr result = new_register(T_INT);
3073   __ load(counter, result);
3074   __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
3075   __ store(result, counter);
3076   if (notify) {




3036     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
3037   } else if (level == CompLevel_full_profile) {
3038     freq_log = (backedge ? Tier3BackedgeNotifyFreqLog : Tier3InvokeNotifyFreqLog);
3039   } else {
3040     ShouldNotReachHere();
3041   }
3042   // Increment the appropriate invocation/backedge counter and notify the runtime.
3043   increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
3044 }
3045 
3046 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
3047                                                 ciMethod *method, int frequency,
3048                                                 int bci, bool backedge, bool notify) {
3049   assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0");
3050   int level = _compilation->env()->comp_level();
3051   assert(level > CompLevel_simple, "Shouldn't be here");
3052 
3053   int offset = -1;
3054   LIR_Opr counter_holder;
3055   if (level == CompLevel_limited_profile) {
3056     MethodCounters* counters_adr = method->ensure_method_counters();
3057     if (counters_adr == NULL) {
3058       bailout("method counters allocation failed");
3059       return;
3060     }
3061     counter_holder = new_pointer_register();
3062     __ move(LIR_OprFact::intptrConst(counters_adr), counter_holder);
3063     offset = in_bytes(backedge ? MethodCounters::backedge_counter_offset() :
3064                                  MethodCounters::invocation_counter_offset());
3065   } else if (level == CompLevel_full_profile) {
3066     counter_holder = new_register(T_METADATA);
3067     offset = in_bytes(backedge ? MethodData::backedge_counter_offset() :
3068                                  MethodData::invocation_counter_offset());
3069     ciMethodData* md = method->method_data_or_null();
3070     assert(md != NULL, "Sanity");
3071     __ metadata2reg(md->constant_encoding(), counter_holder);
3072   } else {
3073     ShouldNotReachHere();
3074   }
3075   LIR_Address* counter = new LIR_Address(counter_holder, offset, T_INT);
3076   LIR_Opr result = new_register(T_INT);
3077   __ load(counter, result);
3078   __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
3079   __ store(result, counter);
3080   if (notify) {


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