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