aboutsummaryrefslogtreecommitdiff
path: root/src/vm_arm.dasc
diff options
context:
space:
mode:
authorMike Pall <mike>2014-01-16 22:53:27 +0100
committerMike Pall <mike>2014-01-16 22:53:27 +0100
commitce9e8ed675d1fb7fe8e148a328fe0b892791a5f4 (patch)
tree34792c8d5acc204d5b3067a057a7b4a4e2af4008 /src/vm_arm.dasc
parentba9dde2ce65f793017d7ccaa9e97fa57b3a87222 (diff)
downloadluajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.tar.gz
luajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.tar.bz2
luajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.zip
Fix KBASE for Lua functions below stitched fast functions.
Diffstat (limited to 'src/vm_arm.dasc')
-rw-r--r--src/vm_arm.dasc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc
index 559d20bd..8a48016e 100644
--- a/src/vm_arm.dasc
+++ b/src/vm_arm.dasc
@@ -2109,6 +2109,8 @@ static void build_subroutines(BuildCtx *ctx)
2109 | bhi >9 // More results wanted? 2109 | bhi >9 // More results wanted?
2110 | 2110 |
2111 | ldr TRACE:RA, [CARG1, CARG3, lsl #2] 2111 | ldr TRACE:RA, [CARG1, CARG3, lsl #2]
2112 | cmp TRACE:RA, #0
2113 | beq ->cont_nop
2112 | ldrh RC, TRACE:RA->link 2114 | ldrh RC, TRACE:RA->link
2113 | cmp RC, CARG3 2115 | cmp RC, CARG3
2114 | beq ->cont_nop // Blacklisted. 2116 | beq ->cont_nop // Blacklisted.
@@ -2193,7 +2195,7 @@ static void build_subroutines(BuildCtx *ctx)
2193 | ldr L, SAVE_L 2195 | ldr L, SAVE_L
2194 |1: 2196 |1:
2195 | cmp CARG1, #0 2197 | cmp CARG1, #0
2196 | blt >3 // Check for error from exit. 2198 | blt >9 // Check for error from exit.
2197 | lsl RC, CARG1, #3 2199 | lsl RC, CARG1, #3
2198 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC] 2200 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
2199 | str RC, SAVE_MULTRES 2201 | str RC, SAVE_MULTRES
@@ -2209,6 +2211,9 @@ static void build_subroutines(BuildCtx *ctx)
2209 | ldr INS, [PC], #4 2211 | ldr INS, [PC], #4
2210 | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. 2212 | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8.
2211 | st_vmstate CARG4 2213 | st_vmstate CARG4
2214 | cmp OP, #BC_FUNCC+2 // Fast function?
2215 | bhs >4
2216 |2:
2212 | cmp OP, #BC_FUNCF // Function header? 2217 | cmp OP, #BC_FUNCF // Function header?
2213 | ldr OP, [DISPATCH, OP, lsl #2] 2218 | ldr OP, [DISPATCH, OP, lsl #2]
2214 | decode_RA8 RA, INS 2219 | decode_RA8 RA, INS
@@ -2218,7 +2223,20 @@ static void build_subroutines(BuildCtx *ctx)
2218 | ldrhs CARG3, [BASE, FRAME_FUNC] 2223 | ldrhs CARG3, [BASE, FRAME_FUNC]
2219 | bx OP 2224 | bx OP
2220 | 2225 |
2221 |3: // Rethrow error from the right C frame. 2226 |4: // Check frame below fast function.
2227 | ldr CARG1, [BASE, FRAME_PC]
2228 | ands CARG2, CARG1, #FRAME_TYPE
2229 | bne <2 // Trace stitching continuation?
2230 | // Otherwise set KBASE for Lua function below fast function.
2231 | ldr CARG3, [CARG1, #-4]
2232 | decode_RA8 CARG1, CARG3
2233 | sub CARG2, BASE, CARG1
2234 | ldr LFUNC:CARG3, [CARG2, #-16]
2235 | ldr CARG3, LFUNC:CARG3->field_pc
2236 | ldr KBASE, [CARG3, #PC2PROTO(k)]
2237 | b <2
2238 |
2239 |9: // Rethrow error from the right C frame.
2222 | rsb CARG2, CARG1, #0 2240 | rsb CARG2, CARG1, #0
2223 | mov CARG1, L 2241 | mov CARG1, L
2224 | bl extern lj_err_throw // (lua_State *L, int errcode) 2242 | bl extern lj_err_throw // (lua_State *L, int errcode)