hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
changeset 17003 c88b0123f0f6
parent 16997 d5dfdf746abd
parent 17000 11bf92e571a2
child 18097 acd70736bd60
equal deleted inserted replaced
16999:223258dbde0a 17003:c88b0123f0f6
  1609   }
  1609   }
  1610 
  1610 
  1611   // Normal (non-jsr) branch handling
  1611   // Normal (non-jsr) branch handling
  1612 
  1612 
  1613   // Save the current Lbcp
  1613   // Save the current Lbcp
  1614   const Register O0_cur_bcp = O0;
  1614   const Register l_cur_bcp = Lscratch;
  1615   __ mov( Lbcp, O0_cur_bcp );
  1615   __ mov( Lbcp, l_cur_bcp );
  1616 
       
  1617 
  1616 
  1618   bool increment_invocation_counter_for_backward_branches = UseCompiler && UseLoopCounter;
  1617   bool increment_invocation_counter_for_backward_branches = UseCompiler && UseLoopCounter;
  1619   if ( increment_invocation_counter_for_backward_branches ) {
  1618   if ( increment_invocation_counter_for_backward_branches ) {
  1620     Label Lforward;
  1619     Label Lforward;
  1621     // check branch direction
  1620     // check branch direction
  1622     __ br( Assembler::positive, false,  Assembler::pn, Lforward );
  1621     __ br( Assembler::positive, false,  Assembler::pn, Lforward );
  1623     // Bump bytecode pointer by displacement (take the branch)
  1622     // Bump bytecode pointer by displacement (take the branch)
  1624     __ delayed()->add( O1_disp, Lbcp, Lbcp );     // add to bc addr
  1623     __ delayed()->add( O1_disp, Lbcp, Lbcp );     // add to bc addr
       
  1624 
       
  1625     const Register Rcounters = G3_scratch;
       
  1626     __ get_method_counters(Lmethod, Rcounters, Lforward);
  1625 
  1627 
  1626     if (TieredCompilation) {
  1628     if (TieredCompilation) {
  1627       Label Lno_mdo, Loverflow;
  1629       Label Lno_mdo, Loverflow;
  1628       int increment = InvocationCounter::count_increment;
  1630       int increment = InvocationCounter::count_increment;
  1629       int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
  1631       int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
  1633         __ br_null_short(G4_scratch, Assembler::pn, Lno_mdo);
  1635         __ br_null_short(G4_scratch, Assembler::pn, Lno_mdo);
  1634 
  1636 
  1635         // Increment backedge counter in the MDO
  1637         // Increment backedge counter in the MDO
  1636         Address mdo_backedge_counter(G4_scratch, in_bytes(MethodData::backedge_counter_offset()) +
  1638         Address mdo_backedge_counter(G4_scratch, in_bytes(MethodData::backedge_counter_offset()) +
  1637                                                  in_bytes(InvocationCounter::counter_offset()));
  1639                                                  in_bytes(InvocationCounter::counter_offset()));
  1638         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, Lscratch,
  1640         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0,
  1639                                    Assembler::notZero, &Lforward);
  1641                                    Assembler::notZero, &Lforward);
  1640         __ ba_short(Loverflow);
  1642         __ ba_short(Loverflow);
  1641       }
  1643       }
  1642 
  1644 
  1643       // If there's no MDO, increment counter in Method*
  1645       // If there's no MDO, increment counter in MethodCounters*
  1644       __ bind(Lno_mdo);
  1646       __ bind(Lno_mdo);
  1645       Address backedge_counter(Lmethod, in_bytes(Method::backedge_counter_offset()) +
  1647       Address backedge_counter(Rcounters,
  1646                                         in_bytes(InvocationCounter::counter_offset()));
  1648               in_bytes(MethodCounters::backedge_counter_offset()) +
  1647       __ increment_mask_and_jump(backedge_counter, increment, mask, G3_scratch, Lscratch,
  1649               in_bytes(InvocationCounter::counter_offset()));
       
  1650       __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0,
  1648                                  Assembler::notZero, &Lforward);
  1651                                  Assembler::notZero, &Lforward);
  1649       __ bind(Loverflow);
  1652       __ bind(Loverflow);
  1650 
  1653 
  1651       // notify point for loop, pass branch bytecode
  1654       // notify point for loop, pass branch bytecode
  1652       __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), O0_cur_bcp);
  1655       __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), l_cur_bcp);
  1653 
  1656 
  1654       // Was an OSR adapter generated?
  1657       // Was an OSR adapter generated?
  1655       // O0 = osr nmethod
  1658       // O0 = osr nmethod
  1656       __ br_null_short(O0, Assembler::pn, Lforward);
  1659       __ br_null_short(O0, Assembler::pn, Lforward);
  1657 
  1660 
  1684       __ delayed()->nop();
  1687       __ delayed()->nop();
  1685 
  1688 
  1686     } else {
  1689     } else {
  1687       // Update Backedge branch separately from invocations
  1690       // Update Backedge branch separately from invocations
  1688       const Register G4_invoke_ctr = G4;
  1691       const Register G4_invoke_ctr = G4;
  1689       __ increment_backedge_counter(G4_invoke_ctr, G1_scratch);
  1692       __ increment_backedge_counter(Rcounters, G4_invoke_ctr, G1_scratch);
  1690       if (ProfileInterpreter) {
  1693       if (ProfileInterpreter) {
  1691         __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward);
  1694         __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward);
  1692         if (UseOnStackReplacement) {
  1695         if (UseOnStackReplacement) {
  1693           __ test_backedge_count_for_osr(O2_bumped_count, O0_cur_bcp, G3_scratch);
  1696           __ test_backedge_count_for_osr(O2_bumped_count, l_cur_bcp, G3_scratch);
  1694         }
  1697         }
  1695       } else {
  1698       } else {
  1696         if (UseOnStackReplacement) {
  1699         if (UseOnStackReplacement) {
  1697           __ test_backedge_count_for_osr(G4_invoke_ctr, O0_cur_bcp, G3_scratch);
  1700           __ test_backedge_count_for_osr(G4_invoke_ctr, l_cur_bcp, G3_scratch);
  1698         }
  1701         }
  1699       }
  1702       }
  1700     }
  1703     }
  1701 
  1704 
  1702     __ bind(Lforward);
  1705     __ bind(Lforward);