2780 |
2780 |
2781 // receiver is guaranteed non-NULL so don't need CodeEmitInfo |
2781 // receiver is guaranteed non-NULL so don't need CodeEmitInfo |
2782 __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL); |
2782 __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL); |
2783 } |
2783 } |
2784 } |
2784 } |
2785 |
2785 if (compilation()->age_code()) { |
|
2786 CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, 0), NULL, false); |
|
2787 decrement_age(info); |
|
2788 } |
2786 // increment invocation counters if needed |
2789 // increment invocation counters if needed |
2787 if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting. |
2790 if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting. |
2788 profile_parameters(x); |
2791 profile_parameters(x); |
2789 CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, SynchronizationEntryBCI), NULL, false); |
2792 CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, SynchronizationEntryBCI), NULL, false); |
2790 increment_invocation_counter(info); |
2793 increment_invocation_counter(info); |
3326 } |
3329 } |
3327 // Increment the appropriate invocation/backedge counter and notify the runtime. |
3330 // Increment the appropriate invocation/backedge counter and notify the runtime. |
3328 increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true); |
3331 increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true); |
3329 } |
3332 } |
3330 |
3333 |
|
3334 void LIRGenerator::decrement_age(CodeEmitInfo* info) { |
|
3335 ciMethod* method = info->scope()->method(); |
|
3336 MethodCounters* mc_adr = method->ensure_method_counters(); |
|
3337 if (mc_adr != NULL) { |
|
3338 LIR_Opr mc = new_pointer_register(); |
|
3339 __ move(LIR_OprFact::intptrConst(mc_adr), mc); |
|
3340 int offset = in_bytes(MethodCounters::nmethod_age_offset()); |
|
3341 LIR_Address* counter = new LIR_Address(mc, offset, T_INT); |
|
3342 LIR_Opr result = new_register(T_INT); |
|
3343 __ load(counter, result); |
|
3344 __ sub(result, LIR_OprFact::intConst(1), result); |
|
3345 __ store(result, counter); |
|
3346 // DeoptimizeStub will reexecute from the current state in code info. |
|
3347 CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured, |
|
3348 Deoptimization::Action_make_not_entrant); |
|
3349 __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0)); |
|
3350 __ branch(lir_cond_lessEqual, T_INT, deopt); |
|
3351 } |
|
3352 } |
|
3353 |
|
3354 |
3331 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info, |
3355 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info, |
3332 ciMethod *method, int frequency, |
3356 ciMethod *method, int frequency, |
3333 int bci, bool backedge, bool notify) { |
3357 int bci, bool backedge, bool notify) { |
3334 assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0"); |
3358 assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0"); |
3335 int level = _compilation->env()->comp_level(); |
3359 int level = _compilation->env()->comp_level(); |