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