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