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