Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8294492: RISC-V: Use li instead of patchable movptr at non-patchable callsites #10462

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
Original file line number Diff line number Diff line change
@@ -529,6 +529,8 @@ class MacroAssembler: public Assembler {
// mv
void mv(Register Rd, address addr) { li(Rd, (int64_t)addr); }
void mv(Register Rd, address addr, int32_t &offset) {
Copy link
Member

@RealFYang RealFYang Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add necessary comment for this function, like:
"Split address into a lower 12-bit sign-extended offset and the remainder so that the offset could be encoded in jalr or load/store instruction."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added.

// Split address into a lower 12-bit sign-extended offset and the remainder,
// so that the offset could be encoded in jalr or load/store instruction.
offset = ((int32_t)(uintptr_t)addr << 20) >> 20;
Copy link
Member

@RealFYang RealFYang Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind one more tweak here? Considering that the type of 'offset' is int32_t, I think it will be more readable here if we convert 'addr' into int64_t type instead of uintptr_t.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. Also changed other uintptr_t usages to int64_t.

li(Rd, (uintptr_t)addr - offset);
}
@@ -894,7 +896,7 @@ class MacroAssembler: public Assembler {

void rt_call(address dest, Register tmp = t0);

void call(const address &dest, Register temp = t0) {
void call(const address dest, Register temp = t0) {
assert_cond(dest != NULL);
assert(temp != noreg, "temp must not be empty register!");
int32_t offset = 0;