1670
1671 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1672
1673 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1674 addi(R28_mdx, R28_mdx, to_add);
1675 off_to_args += to_add;
1676 }
1677
1678 if (MethodData::profile_return()) {
1679 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1680 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1681 }
1682
1683 bind(done);
1684
1685 if (MethodData::profile_return()) {
1686 // We're right after the type profile for the last
1687 // argument. tmp1 is the number of cells left in the
1688 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1689 // if there's a return to profile.
1690 assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1691 "can't move past ret type");
1692 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1693 add(R28_mdx, tmp1, R28_mdx);
1694 }
1695 } else {
1696 assert(MethodData::profile_return(), "either profile call args or call ret");
1697 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1698 }
1699
1700 // Mdp points right after the end of the
1701 // CallTypeData/VirtualCallTypeData, right after the cells for the
1702 // return value type if there's one.
1703 align(32, 12);
1704 bind(profile_continue);
1705 }
1706 }
1707
1708 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1709 assert_different_registers(ret, tmp1, tmp2);
1710 if (ProfileInterpreter && MethodData::profile_return()) {
1711 Label profile_continue;
1712
1713 test_method_data_pointer(profile_continue);
1714
1715 if (MethodData::profile_return_jsr292_only()) {
1716 // If we don't profile all invoke bytecodes we must make sure
1717 // it's a bytecode we indeed profile. We can't go back to the
1718 // beginning of the ProfileData we intend to update to check its
1719 // type because we're right after it and we don't known its
1720 // length.
1721 lbz(tmp1, 0, R14_bcp);
1722 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1723 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1724 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1725 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1726 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1727 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1728 bne(CR0, profile_continue);
1729 }
1730
1731 profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
1732
1733 align(32, 12);
1734 bind(profile_continue);
1735 }
1736 }
1737
1738 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1739 Register tmp3, Register tmp4) {
1740 if (ProfileInterpreter && MethodData::profile_parameters()) {
1741 Label profile_continue, done;
1742
1743 test_method_data_pointer(profile_continue);
1744
1745 // Load the offset of the area within the MDO used for
1746 // parameters. If it's negative we're not profiling any parameters.
1747 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1748 cmpwi(CR0, tmp1, 0);
1749 blt(CR0, profile_continue);
1750
1751 // Compute a pointer to the area for parameters from the offset
|
1670
1671 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1672
1673 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1674 addi(R28_mdx, R28_mdx, to_add);
1675 off_to_args += to_add;
1676 }
1677
1678 if (MethodData::profile_return()) {
1679 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1680 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1681 }
1682
1683 bind(done);
1684
1685 if (MethodData::profile_return()) {
1686 // We're right after the type profile for the last
1687 // argument. tmp1 is the number of cells left in the
1688 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1689 // if there's a return to profile.
1690 assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1691 "can't move past ret type");
1692 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1693 add(R28_mdx, tmp1, R28_mdx);
1694 }
1695 } else {
1696 assert(MethodData::profile_return(), "either profile call args or call ret");
1697 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1698 }
1699
1700 // Mdp points right after the end of the
1701 // CallTypeData/VirtualCallTypeData, right after the cells for the
1702 // return value type if there's one.
1703 align(32, 12);
1704 bind(profile_continue);
1705 }
1706 }
1707
1708 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1709 assert_different_registers(ret, tmp1, tmp2);
1710 if (ProfileInterpreter && MethodData::profile_return()) {
1711 Label profile_continue;
1712
1713 test_method_data_pointer(profile_continue);
1714
1715 if (MethodData::profile_return_jsr292_only()) {
1716 // If we don't profile all invoke bytecodes we must make sure
1717 // it's a bytecode we indeed profile. We can't go back to the
1718 // beginning of the ProfileData we intend to update to check its
1719 // type because we're right after it and we don't known its
1720 // length.
1721 lbz(tmp1, 0, R14_bcp);
1722 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1723 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1724 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1725 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1726 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1727 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1728 bne(CR0, profile_continue);
1729 }
1730
1731 profile_obj_type(ret, R28_mdx, -in_bytes(SingleTypeEntry::size()), tmp1, tmp2);
1732
1733 align(32, 12);
1734 bind(profile_continue);
1735 }
1736 }
1737
1738 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1739 Register tmp3, Register tmp4) {
1740 if (ProfileInterpreter && MethodData::profile_parameters()) {
1741 Label profile_continue, done;
1742
1743 test_method_data_pointer(profile_continue);
1744
1745 // Load the offset of the area within the MDO used for
1746 // parameters. If it's negative we're not profiling any parameters.
1747 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1748 cmpwi(CR0, tmp1, 0);
1749 blt(CR0, profile_continue);
1750
1751 // Compute a pointer to the area for parameters from the offset
|