1580
1581 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1582
1583 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1584 addi(R28_mdx, R28_mdx, to_add);
1585 off_to_args += to_add;
1586 }
1587
1588 if (MethodData::profile_return()) {
1589 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1590 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1591 }
1592
1593 bind(done);
1594
1595 if (MethodData::profile_return()) {
1596 // We're right after the type profile for the last
1597 // argument. tmp1 is the number of cells left in the
1598 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1599 // if there's a return to profile.
1600 assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1601 "can't move past ret type");
1602 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1603 add(R28_mdx, tmp1, R28_mdx);
1604 }
1605 } else {
1606 assert(MethodData::profile_return(), "either profile call args or call ret");
1607 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1608 }
1609
1610 // Mdp points right after the end of the
1611 // CallTypeData/VirtualCallTypeData, right after the cells for the
1612 // return value type if there's one.
1613 align(32, 12);
1614 bind(profile_continue);
1615 }
1616 }
1617
1618 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1619 assert_different_registers(ret, tmp1, tmp2);
1620 if (ProfileInterpreter && MethodData::profile_return()) {
1621 Label profile_continue;
1622
1623 test_method_data_pointer(profile_continue);
1624
1625 if (MethodData::profile_return_jsr292_only()) {
1626 // If we don't profile all invoke bytecodes we must make sure
1627 // it's a bytecode we indeed profile. We can't go back to the
1628 // beginning of the ProfileData we intend to update to check its
1629 // type because we're right after it and we don't known its
1630 // length.
1631 lbz(tmp1, 0, R14_bcp);
1632 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1633 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1634 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1635 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1636 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1637 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1638 bne(CR0, profile_continue);
1639 }
1640
1641 profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
1642
1643 align(32, 12);
1644 bind(profile_continue);
1645 }
1646 }
1647
1648 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1649 Register tmp3, Register tmp4) {
1650 if (ProfileInterpreter && MethodData::profile_parameters()) {
1651 Label profile_continue, done;
1652
1653 test_method_data_pointer(profile_continue);
1654
1655 // Load the offset of the area within the MDO used for
1656 // parameters. If it's negative we're not profiling any parameters.
1657 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1658 cmpwi(CR0, tmp1, 0);
1659 blt(CR0, profile_continue);
1660
1661 // Compute a pointer to the area for parameters from the offset
|
1580
1581 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1582
1583 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1584 addi(R28_mdx, R28_mdx, to_add);
1585 off_to_args += to_add;
1586 }
1587
1588 if (MethodData::profile_return()) {
1589 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1590 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1591 }
1592
1593 bind(done);
1594
1595 if (MethodData::profile_return()) {
1596 // We're right after the type profile for the last
1597 // argument. tmp1 is the number of cells left in the
1598 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1599 // if there's a return to profile.
1600 assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1601 "can't move past ret type");
1602 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1603 add(R28_mdx, tmp1, R28_mdx);
1604 }
1605 } else {
1606 assert(MethodData::profile_return(), "either profile call args or call ret");
1607 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1608 }
1609
1610 // Mdp points right after the end of the
1611 // CallTypeData/VirtualCallTypeData, right after the cells for the
1612 // return value type if there's one.
1613 align(32, 12);
1614 bind(profile_continue);
1615 }
1616 }
1617
1618 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1619 assert_different_registers(ret, tmp1, tmp2);
1620 if (ProfileInterpreter && MethodData::profile_return()) {
1621 Label profile_continue;
1622
1623 test_method_data_pointer(profile_continue);
1624
1625 if (MethodData::profile_return_jsr292_only()) {
1626 // If we don't profile all invoke bytecodes we must make sure
1627 // it's a bytecode we indeed profile. We can't go back to the
1628 // beginning of the ProfileData we intend to update to check its
1629 // type because we're right after it and we don't known its
1630 // length.
1631 lbz(tmp1, 0, R14_bcp);
1632 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1633 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1634 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1635 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1636 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1637 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1638 bne(CR0, profile_continue);
1639 }
1640
1641 profile_obj_type(ret, R28_mdx, -in_bytes(SingleTypeEntry::size()), tmp1, tmp2);
1642
1643 align(32, 12);
1644 bind(profile_continue);
1645 }
1646 }
1647
1648 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1649 Register tmp3, Register tmp4) {
1650 if (ProfileInterpreter && MethodData::profile_parameters()) {
1651 Label profile_continue, done;
1652
1653 test_method_data_pointer(profile_continue);
1654
1655 // Load the offset of the area within the MDO used for
1656 // parameters. If it's negative we're not profiling any parameters.
1657 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1658 cmpwi(CR0, tmp1, 0);
1659 blt(CR0, profile_continue);
1660
1661 // Compute a pointer to the area for parameters from the offset
|