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