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