@@ -1259,21 +1259,21 @@ int MachCallRuntimeNode::ret_addr_offset() {
1259
1259
// jal(addr)
1260
1260
// or with far branches
1261
1261
// jal(trampoline_stub)
1262
- // for real runtime callouts it will be 11 instructions
1262
+ // for real runtime callouts it will be 9 instructions
1263
1263
// see riscv_enc_java_to_runtime
1264
1264
// la(t0, retaddr) -> auipc + addi
1265
- // la(t1, RuntimeAddress(addr)) -> lui + addi + slli + addi + slli + addi
1266
1265
// addi(sp, sp, -2 * wordSize) -> addi
1267
- // sd(t1, Address(sp, wordSize)) -> sd
1268
- // jalr(t1) -> jalr
1266
+ // sd(t0, Address(sp, wordSize)) -> sd
1267
+ // movptr(t1, addr, offset, t0) -> lui + lui + slli + add
1268
+ // jalr(t1, offset) -> jalr
1269
1269
CodeBlob *cb = CodeCache::find_blob(_entry_point);
1270
1270
if (cb != nullptr) {
1271
1271
if (UseTrampolines) {
1272
1272
return 1 * NativeInstruction::instruction_size;
1273
1273
}
1274
1274
return 3 * NativeInstruction::instruction_size;
1275
1275
} else {
1276
- return 11 * NativeInstruction::instruction_size;
1276
+ return 9 * NativeInstruction::instruction_size;
1277
1277
}
1278
1278
}
1279
1279
@@ -2505,11 +2505,13 @@ encode %{
2505
2505
} else {
2506
2506
Label retaddr;
2507
2507
__ la(t0, retaddr);
2508
- __ la(t1, RuntimeAddress(entry));
2509
2508
// Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc()
2510
2509
__ addi(sp, sp, -2 * wordSize);
2511
2510
__ sd(t0, Address(sp, wordSize));
2512
- __ jalr(t1);
2511
+ int32_t offset = 0;
2512
+ // No relocation needed
2513
+ __ movptr(t1, entry, offset, t0); // lui + lui + slli + add
2514
+ __ jalr(t1, offset);
2513
2515
__ bind(retaddr);
2514
2516
__ post_call_nop();
2515
2517
__ addi(sp, sp, 2 * wordSize);
0 commit comments