1792
1793 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1794
1795 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1796 addi(R28_mdx, R28_mdx, to_add);
1797 off_to_args += to_add;
1798 }
1799
1800 if (MethodData::profile_return()) {
1801 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1802 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1803 }
1804
1805 bind(done);
1806
1807 if (MethodData::profile_return()) {
1808 // We're right after the type profile for the last
1809 // argument. tmp1 is the number of cells left in the
1810 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1811 // if there's a return to profile.
1812 assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1813 "can't move past ret type");
1814 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1815 add(R28_mdx, tmp1, R28_mdx);
1816 }
1817 } else {
1818 assert(MethodData::profile_return(), "either profile call args or call ret");
1819 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1820 }
1821
1822 // Mdp points right after the end of the
1823 // CallTypeData/VirtualCallTypeData, right after the cells for the
1824 // return value type if there's one.
1825 align(32, 12);
1826 bind(profile_continue);
1827 }
1828 }
1829
1830 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1831 assert_different_registers(ret, tmp1, tmp2);
1832 if (ProfileInterpreter && MethodData::profile_return()) {
1833 Label profile_continue;
1834
1835 test_method_data_pointer(profile_continue);
1836
1837 if (MethodData::profile_return_jsr292_only()) {
1838 // If we don't profile all invoke bytecodes we must make sure
1839 // it's a bytecode we indeed profile. We can't go back to the
1840 // begining of the ProfileData we intend to update to check its
1841 // type because we're right after it and we don't known its
1842 // length.
1843 lbz(tmp1, 0, R14_bcp);
1844 lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
1845 cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
1846 cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
1847 cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
1848 cmpwi(CCR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1849 cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
1850 bne(CCR0, profile_continue);
1851 }
1852
1853 profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
1854
1855 align(32, 12);
1856 bind(profile_continue);
1857 }
1858 }
1859
1860 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1861 Register tmp3, Register tmp4) {
1862 if (ProfileInterpreter && MethodData::profile_parameters()) {
1863 Label profile_continue, done;
1864
1865 test_method_data_pointer(profile_continue);
1866
1867 // Load the offset of the area within the MDO used for
1868 // parameters. If it's negative we're not profiling any parameters.
1869 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1870 cmpwi(CCR0, tmp1, 0);
1871 blt(CCR0, profile_continue);
1872
1873 // Compute a pointer to the area for parameters from the offset
|
1792
1793 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1794
1795 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1796 addi(R28_mdx, R28_mdx, to_add);
1797 off_to_args += to_add;
1798 }
1799
1800 if (MethodData::profile_return()) {
1801 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1802 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1803 }
1804
1805 bind(done);
1806
1807 if (MethodData::profile_return()) {
1808 // We're right after the type profile for the last
1809 // argument. tmp1 is the number of cells left in the
1810 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1811 // if there's a return to profile.
1812 assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1813 "can't move past ret type");
1814 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1815 add(R28_mdx, tmp1, R28_mdx);
1816 }
1817 } else {
1818 assert(MethodData::profile_return(), "either profile call args or call ret");
1819 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1820 }
1821
1822 // Mdp points right after the end of the
1823 // CallTypeData/VirtualCallTypeData, right after the cells for the
1824 // return value type if there's one.
1825 align(32, 12);
1826 bind(profile_continue);
1827 }
1828 }
1829
1830 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1831 assert_different_registers(ret, tmp1, tmp2);
1832 if (ProfileInterpreter && MethodData::profile_return()) {
1833 Label profile_continue;
1834
1835 test_method_data_pointer(profile_continue);
1836
1837 if (MethodData::profile_return_jsr292_only()) {
1838 // If we don't profile all invoke bytecodes we must make sure
1839 // it's a bytecode we indeed profile. We can't go back to the
1840 // begining of the ProfileData we intend to update to check its
1841 // type because we're right after it and we don't known its
1842 // length.
1843 lbz(tmp1, 0, R14_bcp);
1844 lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
1845 cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
1846 cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
1847 cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
1848 cmpwi(CCR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1849 cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
1850 bne(CCR0, profile_continue);
1851 }
1852
1853 profile_obj_type(ret, R28_mdx, -in_bytes(SingleTypeEntry::size()), tmp1, tmp2);
1854
1855 align(32, 12);
1856 bind(profile_continue);
1857 }
1858 }
1859
1860 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1861 Register tmp3, Register tmp4) {
1862 if (ProfileInterpreter && MethodData::profile_parameters()) {
1863 Label profile_continue, done;
1864
1865 test_method_data_pointer(profile_continue);
1866
1867 // Load the offset of the area within the MDO used for
1868 // parameters. If it's negative we're not profiling any parameters.
1869 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1870 cmpwi(CCR0, tmp1, 0);
1871 blt(CCR0, profile_continue);
1872
1873 // Compute a pointer to the area for parameters from the offset
|