Skip to content

Commit

Permalink
JIT: Improved performance of bx handling a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
Gericom committed Oct 14, 2023
1 parent 2846e0d commit 280b011
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
9 changes: 6 additions & 3 deletions code/core/arm9/source/JitPatcher/JitArmUndefinedBx.s
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ensureJittedCommonHiReg:
ldr r8, [r13]

ensureJittedCommon:
cmp r8, #0x08000000
addhs r8, r8, #(0x02200000 - 0x08000000)

ldr r10, [r13, #(vm_undefinedSpsr - vm_undefinedRegTmp)]
ldr sp,= dtcmStackEnd
tst r8, #1
Expand Down Expand Up @@ -59,9 +62,9 @@ ensureJittedStaticRom:
ensureJittedIWram:
mov lr, r11, lsr #24
cmp lr, #2
moveq lr, #0
mcreq p15, 0, lr, c7, c10, 4
mcreq p15, 0, lr, c7, c5, 0
moveq lr, #0
mcreq p15, 0, lr, c7, c10, 4
mcreq p15, 0, lr, c7, c5, 0

ldr r11,= (gJitState + 0x20000) // iWramJitBits
mov r9, r9, lsr #1
Expand Down
18 changes: 13 additions & 5 deletions code/core/arm9/source/JitPatcher/JitThumbEnsureJitted.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ arm_func jit_thumbEnsureJittedHiReg
ldr r8, [sp, #-4]

arm_func jit_thumbEnsureJitted
cmp r8, #0x08000000
addhs r8, r8, #(0x02200000 - 0x08000000)
sub lr, r8, #0x02200000
cmp lr, #0x00200000
bhs 1f
Expand All @@ -23,17 +25,23 @@ arm_func jit_thumbEnsureJitted
movcss pc, r8

1:
tst r8, #1
biceq r10, r10, #0x20 // thumb bit

and lr, r8, #0x0FF00000
cmp lr, #0x06800000
beq 2f

mov lr, r11, lsr #24
cmp lr, #2
moveq lr, #0
mcreq p15, 0, lr, c7, c10, 4
mcreq p15, 0, lr, c7, c5, 0
moveq lr, #0
mcreq p15, 0, lr, c7, c10, 4
mcreq p15, 0, lr, c7, c5, 0

tst r8, #1
biceq r10, r10, #0x20 // thumb bit
push {r0-r3}
mov r0, r8
bl jit_ensureBlockJitted
pop {r0-r3}
2:
msr spsr, r10
movs pc, r8

0 comments on commit 280b011

Please sign in to comment.