Skip to content

Commit d46c73c

Browse files
committed
8293474: RISC-V: Unify the way of moving function pointer
Reviewed-by: gcao, fyang Backport-of: fc5f97fe379825cb927666ae26aef00082cfae56
1 parent 7c55d32 commit d46c73c

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/hotspot/cpu/riscv/macroAssembler_riscv.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void MacroAssembler::verify_oop(Register reg, const char* s) {
388388
// The length of the instruction sequence emitted should be independent
389389
// of the values of the local char buffer address so that the size of mach
390390
// nodes for scratch emit and normal emit matches.
391-
mv(t0, (address)b);
391+
movptr(t0, (address)b);
392392

393393
// call indirectly to solve generation ordering problem
394394
int32_t offset = 0;
@@ -427,7 +427,7 @@ void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
427427
// The length of the instruction sequence emitted should be independent
428428
// of the values of the local char buffer address so that the size of mach
429429
// nodes for scratch emit and normal emit matches.
430-
mv(t0, (address)b);
430+
movptr(t0, (address)b);
431431

432432
// call indirectly to solve generation ordering problem
433433
int32_t offset = 0;
@@ -1293,12 +1293,6 @@ void MacroAssembler::mv(Register Rd, Address dest) {
12931293
movptr(Rd, dest.target());
12941294
}
12951295

1296-
void MacroAssembler::mv(Register Rd, address addr) {
1297-
// Here in case of use with relocation, use fix length instruction
1298-
// movptr instead of li
1299-
movptr(Rd, addr);
1300-
}
1301-
13021296
void MacroAssembler::mv(Register Rd, RegisterOrConstant src) {
13031297
if (src.is_register()) {
13041298
mv(Rd, src.as_register());
@@ -2615,11 +2609,10 @@ void MacroAssembler::get_thread(Register thread) {
26152609
RegSet::range(x28, x31) + ra - thread;
26162610
push_reg(saved_regs, sp);
26172611

2618-
int32_t offset = 0;
2619-
movptr_with_offset(ra, CAST_FROM_FN_PTR(address, Thread::current), offset);
2620-
jalr(ra, ra, offset);
2621-
if (thread != x10) {
2622-
mv(thread, x10);
2612+
mv(ra, CAST_FROM_FN_PTR(address, Thread::current));
2613+
jalr(ra);
2614+
if (thread != c_rarg0) {
2615+
mv(thread, c_rarg0);
26232616
}
26242617

26252618
// restore pushed registers

src/hotspot/cpu/riscv/macroAssembler_riscv.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ class MacroAssembler: public Assembler {
530530
}
531531

532532
// mv
533+
void mv(Register Rd, address addr) { li(Rd, (int64_t)addr); }
534+
533535
inline void mv(Register Rd, int imm64) { li(Rd, (int64_t)imm64); }
534536
inline void mv(Register Rd, long imm64) { li(Rd, (int64_t)imm64); }
535537
inline void mv(Register Rd, long long imm64) { li(Rd, (int64_t)imm64); }
@@ -540,7 +542,6 @@ class MacroAssembler: public Assembler {
540542
inline void mvw(Register Rd, int32_t imm32) { mv(Rd, imm32); }
541543

542544
void mv(Register Rd, Address dest);
543-
void mv(Register Rd, address dest);
544545
void mv(Register Rd, RegisterOrConstant src);
545546

546547
// logic

0 commit comments

Comments
 (0)