Skip to content

Commit

Permalink
AArch64: Stop saving/restoring x29 in unnecessary cases
Browse files Browse the repository at this point in the history
This commit introduces SAVE_LR and RESTORE_LR macros and replaces some
of SAVE_FPLR and RESTORE_FPLR.
FP (x29) register is handled by SAVE/RESTORE_PRESERVED_REGS and
SAVE_RESTORE_C_NONVOLATILE_REGS.

Signed-off-by: KONNO Kazuhiro <[email protected]>
  • Loading branch information
knn-k committed Oct 18, 2023
1 parent 7e24d9a commit 8d79733
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions runtime/codert_vm/arm64nathelp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define({CALL_SLOW_PATH_ONLY_HELPER_NO_RETURN_VALUE},{
ret x0
.L_done_$1:
RESTORE_ALL_REGS
RESTORE_FPLR
RESTORE_LR
SWITCH_TO_JAVA_STACK
})

Expand All @@ -46,7 +46,7 @@ define({CALL_SLOW_PATH_ONLY_HELPER_NO_EXCEPTION_NO_RETURN_VALUE},{
str x30,[J9VMTHREAD,{#}J9TR_VMThread_jitReturnAddress]
CALL_C_WITH_VMTHREAD(old_slow_$1)
RESTORE_ALL_REGS
RESTORE_FPLR
RESTORE_LR
SWITCH_TO_JAVA_STACK
})

Expand Down Expand Up @@ -427,15 +427,15 @@ BEGIN_HELPER(jitAcquireVMAccess)
mov x0,J9VMTHREAD
CALL_DIRECT(fast_jitAcquireVMAccess)
RESTORE_ALL_REGS
RESTORE_FPLR
RESTORE_LR
END_HELPER(jitAcquireVMAccess)

BEGIN_HELPER(jitReleaseVMAccess)
SAVE_ALL_REGS
mov x0,J9VMTHREAD
CALL_DIRECT(fast_jitReleaseVMAccess)
RESTORE_ALL_REGS
RESTORE_FPLR
RESTORE_LR
END_HELPER(jitReleaseVMAccess)

START_PROC(cInterpreterFromJIT)
Expand Down Expand Up @@ -513,7 +513,7 @@ dnl x0 contains the method to run
START_PROC(j2iInvokeExact)
SWITCH_TO_C_STACK
SAVE_PRESERVED_REGS
SAVE_FPLR
SAVE_LR
mov x1,x0
mov x0,{#}J9TR_bcloop_j2i_invoke_exact
b FUNC_LABEL(cInterpreterFromJIT)
Expand All @@ -528,7 +528,7 @@ dnl x0 contains the method to run
START_PROC(j2iTransition)
SWITCH_TO_C_STACK
SAVE_PRESERVED_REGS
SAVE_FPLR
SAVE_LR
mov x1,x0
mov x0,{#}J9TR_bcloop_j2i_transition
b FUNC_LABEL(cInterpreterFromJIT)
Expand All @@ -544,7 +544,7 @@ dnl x9 contains the vTable index
START_PROC(j2iVirtual)
SWITCH_TO_C_STACK
SAVE_PRESERVED_REGS
SAVE_FPLR
SAVE_LR
str x9,[J9VMTHREAD,{#}J9TR_VMThread_tempSlot]
mov x1,x0
mov x0,{#}J9TR_bcloop_j2i_virtual
Expand Down
8 changes: 8 additions & 0 deletions runtime/oti/arm64helpers.m4
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ define({RESTORE_FPLR},{
ldr x30,JIT_GPR_SAVE_SLOT(30)
})

define({SAVE_LR},{
str x30,JIT_GPR_SAVE_SLOT(30)
})

define({RESTORE_LR},{
ldr x30,JIT_GPR_SAVE_SLOT(30)
})

define({BEGIN_HELPER},{
START_PROC($1)
SAVE_FPLR
Expand Down

0 comments on commit 8d79733

Please sign in to comment.