< prev index next >

src/hotspot/cpu/riscv/interp_masm_riscv.cpp

Print this page

1576       blt(index, t1, loop);
1577       bind(loopEnd);
1578 
1579       if (MethodData::profile_return()) {
1580         ld(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
1581         sub(tmp, tmp, TypeProfileArgsLimit * TypeStackSlotEntries::per_arg_count());
1582       }
1583 
1584       add(t0, mdp, off_to_args);
1585       bind(done);
1586       mv(mdp, t0);
1587 
1588       // unspill the clobbered registers
1589       pop_reg(pushed_registers, sp);
1590 
1591       if (MethodData::profile_return()) {
1592         // We're right after the type profile for the last
1593         // argument. tmp is the number of cells left in the
1594         // CallTypeData/VirtualCallTypeData to reach its end. Non null
1595         // if there's a return to profile.
1596         assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
1597         shadd(mdp, tmp, mdp, tmp, exact_log2(DataLayout::cell_size));
1598       }
1599       sd(mdp, Address(fp, frame::interpreter_frame_mdp_offset * wordSize));
1600     } else {
1601       assert(MethodData::profile_return(), "either profile call args or call ret");
1602       update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
1603     }
1604 
1605     // mdp points right after the end of the
1606     // CallTypeData/VirtualCallTypeData, right after the cells for the
1607     // return value type if there's one
1608 
1609     bind(profile_continue);
1610   }
1611 }
1612 
1613 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1614   assert_different_registers(mdp, ret, tmp, xbcp, t0, t1);
1615   if (ProfileInterpreter && MethodData::profile_return()) {
1616     Label profile_continue, done;

1621       assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
1622 
1623       // If we don't profile all invoke bytecodes we must make sure
1624       // it's a bytecode we indeed profile. We can't go back to the
1625       // beginning of the ProfileData we intend to update to check its
1626       // type because we're right after it and we don't known its
1627       // length
1628       Label do_profile;
1629       lbu(t0, Address(xbcp, 0));
1630       mv(tmp, (u1)Bytecodes::_invokedynamic);
1631       beq(t0, tmp, do_profile);
1632       mv(tmp, (u1)Bytecodes::_invokehandle);
1633       beq(t0, tmp, do_profile);
1634       get_method(tmp);
1635       lhu(t0, Address(tmp, Method::intrinsic_id_offset()));
1636       mv(t1, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1637       bne(t0, t1, profile_continue);
1638       bind(do_profile);
1639     }
1640 
1641     Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
1642     mv(tmp, ret);
1643     profile_obj_type(tmp, mdo_ret_addr, t1);
1644 
1645     bind(profile_continue);
1646   }
1647 }
1648 
1649 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2, Register tmp3) {
1650   assert_different_registers(t0, t1, mdp, tmp1, tmp2, tmp3);
1651   if (ProfileInterpreter && MethodData::profile_parameters()) {
1652     Label profile_continue, done;
1653 
1654     test_method_data_pointer(mdp, profile_continue);
1655 
1656     // Load the offset of the area within the MDO used for
1657     // parameters. If it's negative we're not profiling any parameters
1658     lwu(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset())));
1659     srli(tmp2, tmp1, 31);
1660     bnez(tmp2, profile_continue);  // i.e. sign bit set
1661 

1576       blt(index, t1, loop);
1577       bind(loopEnd);
1578 
1579       if (MethodData::profile_return()) {
1580         ld(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
1581         sub(tmp, tmp, TypeProfileArgsLimit * TypeStackSlotEntries::per_arg_count());
1582       }
1583 
1584       add(t0, mdp, off_to_args);
1585       bind(done);
1586       mv(mdp, t0);
1587 
1588       // unspill the clobbered registers
1589       pop_reg(pushed_registers, sp);
1590 
1591       if (MethodData::profile_return()) {
1592         // We're right after the type profile for the last
1593         // argument. tmp is the number of cells left in the
1594         // CallTypeData/VirtualCallTypeData to reach its end. Non null
1595         // if there's a return to profile.
1596         assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
1597         shadd(mdp, tmp, mdp, tmp, exact_log2(DataLayout::cell_size));
1598       }
1599       sd(mdp, Address(fp, frame::interpreter_frame_mdp_offset * wordSize));
1600     } else {
1601       assert(MethodData::profile_return(), "either profile call args or call ret");
1602       update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
1603     }
1604 
1605     // mdp points right after the end of the
1606     // CallTypeData/VirtualCallTypeData, right after the cells for the
1607     // return value type if there's one
1608 
1609     bind(profile_continue);
1610   }
1611 }
1612 
1613 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1614   assert_different_registers(mdp, ret, tmp, xbcp, t0, t1);
1615   if (ProfileInterpreter && MethodData::profile_return()) {
1616     Label profile_continue, done;

1621       assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
1622 
1623       // If we don't profile all invoke bytecodes we must make sure
1624       // it's a bytecode we indeed profile. We can't go back to the
1625       // beginning of the ProfileData we intend to update to check its
1626       // type because we're right after it and we don't known its
1627       // length
1628       Label do_profile;
1629       lbu(t0, Address(xbcp, 0));
1630       mv(tmp, (u1)Bytecodes::_invokedynamic);
1631       beq(t0, tmp, do_profile);
1632       mv(tmp, (u1)Bytecodes::_invokehandle);
1633       beq(t0, tmp, do_profile);
1634       get_method(tmp);
1635       lhu(t0, Address(tmp, Method::intrinsic_id_offset()));
1636       mv(t1, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1637       bne(t0, t1, profile_continue);
1638       bind(do_profile);
1639     }
1640 
1641     Address mdo_ret_addr(mdp, -in_bytes(SingleTypeEntry::size()));
1642     mv(tmp, ret);
1643     profile_obj_type(tmp, mdo_ret_addr, t1);
1644 
1645     bind(profile_continue);
1646   }
1647 }
1648 
1649 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2, Register tmp3) {
1650   assert_different_registers(t0, t1, mdp, tmp1, tmp2, tmp3);
1651   if (ProfileInterpreter && MethodData::profile_parameters()) {
1652     Label profile_continue, done;
1653 
1654     test_method_data_pointer(mdp, profile_continue);
1655 
1656     // Load the offset of the area within the MDO used for
1657     // parameters. If it's negative we're not profiling any parameters
1658     lwu(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset())));
1659     srli(tmp2, tmp1, 31);
1660     bnez(tmp2, profile_continue);  // i.e. sign bit set
1661 
< prev index next >