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