1597 // check branch direction |
1597 // check branch direction |
1598 __ br( Assembler::positive, false, Assembler::pn, Lforward ); |
1598 __ br( Assembler::positive, false, Assembler::pn, Lforward ); |
1599 // Bump bytecode pointer by displacement (take the branch) |
1599 // Bump bytecode pointer by displacement (take the branch) |
1600 __ delayed()->add( O1_disp, Lbcp, Lbcp ); // add to bc addr |
1600 __ delayed()->add( O1_disp, Lbcp, Lbcp ); // add to bc addr |
1601 |
1601 |
1602 const Register Rcounters = G3_scratch; |
1602 const Register G3_method_counters = G3_scratch; |
1603 __ get_method_counters(Lmethod, Rcounters, Lforward); |
1603 __ get_method_counters(Lmethod, G3_method_counters, Lforward); |
1604 |
1604 |
1605 if (TieredCompilation) { |
1605 if (TieredCompilation) { |
1606 Label Lno_mdo, Loverflow; |
1606 Label Lno_mdo, Loverflow; |
1607 int increment = InvocationCounter::count_increment; |
1607 int increment = InvocationCounter::count_increment; |
1608 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift; |
|
1609 if (ProfileInterpreter) { |
1608 if (ProfileInterpreter) { |
1610 // If no method data exists, go to profile_continue. |
1609 // If no method data exists, go to profile_continue. |
1611 __ ld_ptr(Lmethod, Method::method_data_offset(), G4_scratch); |
1610 __ ld_ptr(Lmethod, Method::method_data_offset(), G4_scratch); |
1612 __ br_null_short(G4_scratch, Assembler::pn, Lno_mdo); |
1611 __ br_null_short(G4_scratch, Assembler::pn, Lno_mdo); |
1613 |
1612 |
1614 // Increment backedge counter in the MDO |
1613 // Increment backedge counter in the MDO |
1615 Address mdo_backedge_counter(G4_scratch, in_bytes(MethodData::backedge_counter_offset()) + |
1614 Address mdo_backedge_counter(G4_scratch, in_bytes(MethodData::backedge_counter_offset()) + |
1616 in_bytes(InvocationCounter::counter_offset())); |
1615 in_bytes(InvocationCounter::counter_offset())); |
|
1616 Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset())); |
1617 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0, |
1617 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0, |
1618 Assembler::notZero, &Lforward); |
1618 Assembler::notZero, &Lforward); |
1619 __ ba_short(Loverflow); |
1619 __ ba_short(Loverflow); |
1620 } |
1620 } |
1621 |
1621 |
1622 // If there's no MDO, increment counter in MethodCounters* |
1622 // If there's no MDO, increment counter in MethodCounters* |
1623 __ bind(Lno_mdo); |
1623 __ bind(Lno_mdo); |
1624 Address backedge_counter(Rcounters, |
1624 Address backedge_counter(G3_method_counters, |
1625 in_bytes(MethodCounters::backedge_counter_offset()) + |
1625 in_bytes(MethodCounters::backedge_counter_offset()) + |
1626 in_bytes(InvocationCounter::counter_offset())); |
1626 in_bytes(InvocationCounter::counter_offset())); |
|
1627 Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset())); |
1627 __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0, |
1628 __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0, |
1628 Assembler::notZero, &Lforward); |
1629 Assembler::notZero, &Lforward); |
1629 __ bind(Loverflow); |
1630 __ bind(Loverflow); |
1630 |
1631 |
1631 // notify point for loop, pass branch bytecode |
1632 // notify point for loop, pass branch bytecode |
1661 // Jump to the osr code. |
1662 // Jump to the osr code. |
1662 __ ld_ptr(O1, nmethod::osr_entry_point_offset(), O2); |
1663 __ ld_ptr(O1, nmethod::osr_entry_point_offset(), O2); |
1663 __ jmp(O2, G0); |
1664 __ jmp(O2, G0); |
1664 __ delayed()->nop(); |
1665 __ delayed()->nop(); |
1665 |
1666 |
1666 } else { |
1667 } else { // not TieredCompilation |
1667 // Update Backedge branch separately from invocations |
1668 // Update Backedge branch separately from invocations |
1668 const Register G4_invoke_ctr = G4; |
1669 const Register G4_invoke_ctr = G4; |
1669 __ increment_backedge_counter(Rcounters, G4_invoke_ctr, G1_scratch); |
1670 __ increment_backedge_counter(G3_method_counters, G4_invoke_ctr, G1_scratch); |
1670 if (ProfileInterpreter) { |
1671 if (ProfileInterpreter) { |
1671 __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward); |
1672 __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_method_counters, G1_scratch, Lforward); |
1672 if (UseOnStackReplacement) { |
1673 if (UseOnStackReplacement) { |
1673 __ test_backedge_count_for_osr(O2_bumped_count, l_cur_bcp, G3_scratch); |
1674 |
|
1675 __ test_backedge_count_for_osr(O2_bumped_count, G3_method_counters, l_cur_bcp, G1_scratch); |
1674 } |
1676 } |
1675 } else { |
1677 } else { |
1676 if (UseOnStackReplacement) { |
1678 if (UseOnStackReplacement) { |
1677 __ test_backedge_count_for_osr(G4_invoke_ctr, l_cur_bcp, G3_scratch); |
1679 __ test_backedge_count_for_osr(G4_invoke_ctr, G3_method_counters, l_cur_bcp, G1_scratch); |
1678 } |
1680 } |
1679 } |
1681 } |
1680 } |
1682 } |
1681 |
1683 |
1682 __ bind(Lforward); |
1684 __ bind(Lforward); |