1744 address& iep,
1745 address& lep,
1746 address& fep,
1747 address& dep,
1748 address& vep) {
1749 assert(t != nullptr && t->is_valid() && t->tos_in() == vtos, "illegal template");
1750 Label L;
1751 aep = __ pc(); __ push_ptr(); __ j(L);
1752 fep = __ pc(); __ push_f(); __ j(L);
1753 dep = __ pc(); __ push_d(); __ j(L);
1754 lep = __ pc(); __ push_l(); __ j(L);
1755 bep = cep = sep =
1756 iep = __ pc(); __ push_i();
1757 vep = __ pc();
1758 __ bind(L);
1759 generate_and_dispatch(t);
1760 }
1761
1762 //-----------------------------------------------------------------------------
1763
1764 // Non-product code
1765 #ifndef PRODUCT
1766 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1767 address entry = __ pc();
1768
1769 __ push_reg(ra);
1770 __ push(state);
1771 __ push_reg(RegSet::range(x10, x17) + RegSet::range(x5, x7) + RegSet::range(x28, x31), sp);
1772 __ mv(c_rarg2, x10); // Pass itos
1773 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), c_rarg1, c_rarg2, c_rarg3);
1774 __ pop_reg(RegSet::range(x10, x17) + RegSet::range(x5, x7) + RegSet::range(x28, x31), sp);
1775 __ pop(state);
1776 __ pop_reg(ra);
1777 __ ret(); // return from result handler
1778
1779 return entry;
1780 }
1781
1782 void TemplateInterpreterGenerator::count_bytecode() {
1783 __ mv(x7, (address) &BytecodeCounter::_counter_value);
1784 __ atomic_addw(noreg, 1, x7);
1785 }
1786
1787 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
1788 __ mv(x7, (address) &BytecodeHistogram::_counters[t->bytecode()]);
1789 __ atomic_addw(noreg, 1, x7);
1790 }
1791
1792 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
1793 // Calculate new index for counter:
1794 // _index = (_index >> log2_number_of_codes) |
1795 // (bytecode << log2_number_of_codes);
1796 Register index_addr = t1;
1797 Register index = t0;
1798 __ mv(index_addr, (address) &BytecodePairHistogram::_index);
1799 __ lw(index, index_addr);
1800 __ mv(x7, ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
1801 __ srli(index, index, BytecodePairHistogram::log2_number_of_codes);
1802 __ orrw(index, x7, index);
1803 __ sw(index, index_addr);
1804 // Bump bucket contents:
1805 // _counters[_index] ++;
1806 Register counter_addr = t1;
1807 __ mv(x7, (address) &BytecodePairHistogram::_counters);
1808 __ shadd(counter_addr, index, x7, counter_addr, LogBytesPerInt);
1809 __ atomic_addw(noreg, 1, counter_addr);
1810 }
1811
|
1744 address& iep,
1745 address& lep,
1746 address& fep,
1747 address& dep,
1748 address& vep) {
1749 assert(t != nullptr && t->is_valid() && t->tos_in() == vtos, "illegal template");
1750 Label L;
1751 aep = __ pc(); __ push_ptr(); __ j(L);
1752 fep = __ pc(); __ push_f(); __ j(L);
1753 dep = __ pc(); __ push_d(); __ j(L);
1754 lep = __ pc(); __ push_l(); __ j(L);
1755 bep = cep = sep =
1756 iep = __ pc(); __ push_i();
1757 vep = __ pc();
1758 __ bind(L);
1759 generate_and_dispatch(t);
1760 }
1761
1762 //-----------------------------------------------------------------------------
1763
1764 void TemplateInterpreterGenerator::count_bytecode() {
1765 __ mv(x7, (address) &BytecodeCounter::_counter_value);
1766 __ atomic_addw(noreg, 1, x7);
1767 }
1768
1769 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
1770 __ mv(x7, (address) &BytecodeHistogram::_counters[t->bytecode()]);
1771 __ atomic_addw(noreg, 1, x7);
1772 }
1773
1774 // Non-product code
1775 #ifndef PRODUCT
1776 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1777 address entry = __ pc();
1778
1779 __ push_reg(ra);
1780 __ push(state);
1781 __ push_reg(RegSet::range(x10, x17) + RegSet::range(x5, x7) + RegSet::range(x28, x31), sp);
1782 __ mv(c_rarg2, x10); // Pass itos
1783 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), c_rarg1, c_rarg2, c_rarg3);
1784 __ pop_reg(RegSet::range(x10, x17) + RegSet::range(x5, x7) + RegSet::range(x28, x31), sp);
1785 __ pop(state);
1786 __ pop_reg(ra);
1787 __ ret(); // return from result handler
1788
1789 return entry;
1790 }
1791
1792 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
1793 // Calculate new index for counter:
1794 // _index = (_index >> log2_number_of_codes) |
1795 // (bytecode << log2_number_of_codes);
1796 Register index_addr = t1;
1797 Register index = t0;
1798 __ mv(index_addr, (address) &BytecodePairHistogram::_index);
1799 __ lw(index, index_addr);
1800 __ mv(x7, ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
1801 __ srli(index, index, BytecodePairHistogram::log2_number_of_codes);
1802 __ orrw(index, x7, index);
1803 __ sw(index, index_addr);
1804 // Bump bucket contents:
1805 // _counters[_index] ++;
1806 Register counter_addr = t1;
1807 __ mv(x7, (address) &BytecodePairHistogram::_counters);
1808 __ shadd(counter_addr, index, x7, counter_addr, LogBytesPerInt);
1809 __ atomic_addw(noreg, 1, counter_addr);
1810 }
1811
|