1619 1620 cbnz(obj, update); 1621 orptr(mdo_addr, TypeEntries::null_seen); 1622 b(next); 1623 1624 bind(update); 1625 load_klass(obj, obj); 1626 1627 ldr(rscratch1, mdo_addr); 1628 eor(obj, obj, rscratch1); 1629 tst(obj, TypeEntries::type_klass_mask); 1630 br(Assembler::EQ, next); // klass seen before, nothing to 1631 // do. The unknown bit may have been 1632 // set already but no need to check. 1633 1634 tbnz(obj, exact_log2(TypeEntries::type_unknown), next); 1635 // already unknown. Nothing to do anymore. 1636 1637 ldr(rscratch1, mdo_addr); 1638 cbz(rscratch1, none); 1639 cmp(rscratch1, TypeEntries::null_seen); 1640 br(Assembler::EQ, none); 1641 // There is a chance that the checks above (re-reading profiling 1642 // data from memory) fail if another thread has just set the 1643 // profiling to this obj's klass 1644 ldr(rscratch1, mdo_addr); 1645 eor(obj, obj, rscratch1); 1646 tst(obj, TypeEntries::type_klass_mask); 1647 br(Assembler::EQ, next); 1648 1649 // different than before. Cannot keep accurate profile. 1650 orptr(mdo_addr, TypeEntries::type_unknown); 1651 b(next); 1652 1653 bind(none); 1654 // first time here. Set profile type. 1655 str(obj, mdo_addr); 1656 1657 bind(next); 1658 } 1659 1660 void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) { 1661 if (!ProfileInterpreter) { 1662 return; 1663 } 1664 1665 if (MethodData::profile_arguments() || MethodData::profile_return()) { 1666 Label profile_continue; 1667 1668 test_method_data_pointer(mdp, profile_continue); 1669 1670 int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); 1671 1672 ldrb(rscratch1, Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start)); 1673 cmp(rscratch1, is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag); 1674 br(Assembler::NE, profile_continue); 1675 1676 if (MethodData::profile_arguments()) { 1677 Label done; 1678 int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset()); 1679 1680 for (int i = 0; i < TypeProfileArgsLimit; i++) { 1681 if (i > 0 || MethodData::profile_return()) { 1682 // If return value type is profiled we may have no argument to profile 1683 ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset()))); 1684 sub(tmp, tmp, i*TypeStackSlotEntries::per_arg_count()); 1685 cmp(tmp, TypeStackSlotEntries::per_arg_count()); 1686 add(rscratch1, mdp, off_to_args); 1687 br(Assembler::LT, done); 1688 } 1689 ldr(tmp, Address(callee, Method::const_offset())); 1690 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset())); 1691 // stack offset o (zero based) from the start of the argument 1692 // list, for n arguments translates into offset n - o - 1 from 1693 // the end of the argument list 1694 ldr(rscratch1, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i)))); 1695 sub(tmp, tmp, rscratch1); 1696 sub(tmp, tmp, 1); 1697 Address arg_addr = argument_address(tmp); 1698 ldr(tmp, arg_addr); 1699 1700 Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))); 1701 profile_obj_type(tmp, mdo_arg_addr); 1702 1703 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); 1704 off_to_args += to_add; 1705 } 1735 } 1736 } 1737 1738 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) { 1739 assert_different_registers(mdp, ret, tmp, rbcp); 1740 if (ProfileInterpreter && MethodData::profile_return()) { 1741 Label profile_continue, done; 1742 1743 test_method_data_pointer(mdp, profile_continue); 1744 1745 if (MethodData::profile_return_jsr292_only()) { 1746 assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2"); 1747 1748 // If we don't profile all invoke bytecodes we must make sure 1749 // it's a bytecode we indeed profile. We can't go back to the 1750 // begining of the ProfileData we intend to update to check its 1751 // type because we're right after it and we don't known its 1752 // length 1753 Label do_profile; 1754 ldrb(rscratch1, Address(rbcp, 0)); 1755 cmp(rscratch1, Bytecodes::_invokedynamic); 1756 br(Assembler::EQ, do_profile); 1757 cmp(rscratch1, Bytecodes::_invokehandle); 1758 br(Assembler::EQ, do_profile); 1759 get_method(tmp); 1760 ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes())); 1761 cmp(rscratch1, vmIntrinsics::_compiledLambdaForm); 1762 br(Assembler::NE, profile_continue); 1763 1764 bind(do_profile); 1765 } 1766 1767 Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size())); 1768 mov(tmp, ret); 1769 profile_obj_type(tmp, mdo_ret_addr); 1770 1771 bind(profile_continue); 1772 } 1773 } 1774 1775 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) { 1776 assert_different_registers(rscratch1, rscratch2, mdp, tmp1, tmp2); 1777 if (ProfileInterpreter && MethodData::profile_parameters()) { 1778 Label profile_continue, done; 1779 1780 test_method_data_pointer(mdp, profile_continue); 1781 | 1619 1620 cbnz(obj, update); 1621 orptr(mdo_addr, TypeEntries::null_seen); 1622 b(next); 1623 1624 bind(update); 1625 load_klass(obj, obj); 1626 1627 ldr(rscratch1, mdo_addr); 1628 eor(obj, obj, rscratch1); 1629 tst(obj, TypeEntries::type_klass_mask); 1630 br(Assembler::EQ, next); // klass seen before, nothing to 1631 // do. The unknown bit may have been 1632 // set already but no need to check. 1633 1634 tbnz(obj, exact_log2(TypeEntries::type_unknown), next); 1635 // already unknown. Nothing to do anymore. 1636 1637 ldr(rscratch1, mdo_addr); 1638 cbz(rscratch1, none); 1639 cmp(rscratch1, (u1)TypeEntries::null_seen); 1640 br(Assembler::EQ, none); 1641 // There is a chance that the checks above (re-reading profiling 1642 // data from memory) fail if another thread has just set the 1643 // profiling to this obj's klass 1644 ldr(rscratch1, mdo_addr); 1645 eor(obj, obj, rscratch1); 1646 tst(obj, TypeEntries::type_klass_mask); 1647 br(Assembler::EQ, next); 1648 1649 // different than before. Cannot keep accurate profile. 1650 orptr(mdo_addr, TypeEntries::type_unknown); 1651 b(next); 1652 1653 bind(none); 1654 // first time here. Set profile type. 1655 str(obj, mdo_addr); 1656 1657 bind(next); 1658 } 1659 1660 void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) { 1661 if (!ProfileInterpreter) { 1662 return; 1663 } 1664 1665 if (MethodData::profile_arguments() || MethodData::profile_return()) { 1666 Label profile_continue; 1667 1668 test_method_data_pointer(mdp, profile_continue); 1669 1670 int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); 1671 1672 ldrb(rscratch1, Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start)); 1673 cmp(rscratch1, u1(is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag)); 1674 br(Assembler::NE, profile_continue); 1675 1676 if (MethodData::profile_arguments()) { 1677 Label done; 1678 int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset()); 1679 1680 for (int i = 0; i < TypeProfileArgsLimit; i++) { 1681 if (i > 0 || MethodData::profile_return()) { 1682 // If return value type is profiled we may have no argument to profile 1683 ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset()))); 1684 sub(tmp, tmp, i*TypeStackSlotEntries::per_arg_count()); 1685 cmp(tmp, (u1)TypeStackSlotEntries::per_arg_count()); 1686 add(rscratch1, mdp, off_to_args); 1687 br(Assembler::LT, done); 1688 } 1689 ldr(tmp, Address(callee, Method::const_offset())); 1690 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset())); 1691 // stack offset o (zero based) from the start of the argument 1692 // list, for n arguments translates into offset n - o - 1 from 1693 // the end of the argument list 1694 ldr(rscratch1, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i)))); 1695 sub(tmp, tmp, rscratch1); 1696 sub(tmp, tmp, 1); 1697 Address arg_addr = argument_address(tmp); 1698 ldr(tmp, arg_addr); 1699 1700 Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))); 1701 profile_obj_type(tmp, mdo_arg_addr); 1702 1703 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); 1704 off_to_args += to_add; 1705 } 1735 } 1736 } 1737 1738 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) { 1739 assert_different_registers(mdp, ret, tmp, rbcp); 1740 if (ProfileInterpreter && MethodData::profile_return()) { 1741 Label profile_continue, done; 1742 1743 test_method_data_pointer(mdp, profile_continue); 1744 1745 if (MethodData::profile_return_jsr292_only()) { 1746 assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2"); 1747 1748 // If we don't profile all invoke bytecodes we must make sure 1749 // it's a bytecode we indeed profile. We can't go back to the 1750 // begining of the ProfileData we intend to update to check its 1751 // type because we're right after it and we don't known its 1752 // length 1753 Label do_profile; 1754 ldrb(rscratch1, Address(rbcp, 0)); 1755 cmp(rscratch1, (u1)Bytecodes::_invokedynamic); 1756 br(Assembler::EQ, do_profile); 1757 cmp(rscratch1, (u1)Bytecodes::_invokehandle); 1758 br(Assembler::EQ, do_profile); 1759 get_method(tmp); 1760 ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes())); 1761 subs(zr, rscratch1, vmIntrinsics::_compiledLambdaForm); 1762 br(Assembler::NE, profile_continue); 1763 1764 bind(do_profile); 1765 } 1766 1767 Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size())); 1768 mov(tmp, ret); 1769 profile_obj_type(tmp, mdo_ret_addr); 1770 1771 bind(profile_continue); 1772 } 1773 } 1774 1775 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) { 1776 assert_different_registers(rscratch1, rscratch2, mdp, tmp1, tmp2); 1777 if (ProfileInterpreter && MethodData::profile_parameters()) { 1778 Label profile_continue, done; 1779 1780 test_method_data_pointer(mdp, profile_continue); 1781 |