diff options
author | Mike Pall <mike> | 2023-08-13 02:25:12 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-08-13 02:25:12 +0200 |
commit | 119fd1fab0ebf235669456fbb57ee872fb05fc73 (patch) | |
tree | 2445387dda68d8559bf3fc584e4889bc48230116 /src/vm_arm.dasc | |
parent | 27af72e66f6a285298d1a9be370779aae945eb14 (diff) | |
download | luajit-119fd1fab0ebf235669456fbb57ee872fb05fc73.tar.gz luajit-119fd1fab0ebf235669456fbb57ee872fb05fc73.tar.bz2 luajit-119fd1fab0ebf235669456fbb57ee872fb05fc73.zip |
Ensure forward progress on trace exit to BC_ITERN.
Also use a safer way to force a static dispatch for BC_RET*.
Reported by Bartel Eerdekens. Analyzed by Peter Cawley. #1000 #1045
Diffstat (limited to 'src/vm_arm.dasc')
-rw-r--r-- | src/vm_arm.dasc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index 770c1602..4df4b488 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -2196,8 +2196,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2196 | |.if JIT | 2196 | |.if JIT |
2197 | | ldr L, SAVE_L | 2197 | | ldr L, SAVE_L |
2198 | |1: | 2198 | |1: |
2199 | | cmp CARG1, #0 | 2199 | | cmn CARG1, #LUA_ERRERR |
2200 | | blt >9 // Check for error from exit. | 2200 | | bhs >9 // Check for error from exit. |
2201 | | lsl RC, CARG1, #3 | 2201 | | lsl RC, CARG1, #3 |
2202 | | ldr LFUNC:CARG2, [BASE, FRAME_FUNC] | 2202 | | ldr LFUNC:CARG2, [BASE, FRAME_FUNC] |
2203 | | str RC, SAVE_MULTRES | 2203 | | str RC, SAVE_MULTRES |
@@ -2213,6 +2213,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2213 | | ldr INS, [PC], #4 | 2213 | | ldr INS, [PC], #4 |
2214 | | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. | 2214 | | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. |
2215 | | st_vmstate CARG4 | 2215 | | st_vmstate CARG4 |
2216 | | cmn CARG1, #17 // Static dispatch? | ||
2217 | | beq >5 | ||
2216 | | cmp OP, #BC_FUNCC+2 // Fast function? | 2218 | | cmp OP, #BC_FUNCC+2 // Fast function? |
2217 | | bhs >4 | 2219 | | bhs >4 |
2218 | |2: | 2220 | |2: |
@@ -2238,6 +2240,17 @@ static void build_subroutines(BuildCtx *ctx) | |||
2238 | | ldr KBASE, [CARG3, #PC2PROTO(k)] | 2240 | | ldr KBASE, [CARG3, #PC2PROTO(k)] |
2239 | | b <2 | 2241 | | b <2 |
2240 | | | 2242 | | |
2243 | |5: // Dispatch to static entry of original ins replaced by BC_JLOOP. | ||
2244 | | ldr CARG1, [DISPATCH, #DISPATCH_J(trace)] | ||
2245 | | decode_RD RC, INS | ||
2246 | | ldr TRACE:CARG1, [CARG1, RC, lsl #2] | ||
2247 | | ldr INS, TRACE:CARG1->startins | ||
2248 | | decode_OP OP, INS | ||
2249 | | decode_RA8 RA, INS | ||
2250 | | add OP, DISPATCH, OP, lsl #2 | ||
2251 | | decode_RD RC, INS | ||
2252 | | ldr pc, [OP, #GG_DISP2STATIC] | ||
2253 | | | ||
2241 | |9: // Rethrow error from the right C frame. | 2254 | |9: // Rethrow error from the right C frame. |
2242 | | rsb CARG2, CARG1, #0 | 2255 | | rsb CARG2, CARG1, #0 |
2243 | | mov CARG1, L | 2256 | | mov CARG1, L |