diff options
author | Mike Pall <mike> | 2014-01-16 22:53:27 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2014-01-16 22:53:27 +0100 |
commit | ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4 (patch) | |
tree | 34792c8d5acc204d5b3067a057a7b4a4e2af4008 /src/vm_mips.dasc | |
parent | ba9dde2ce65f793017d7ccaa9e97fa57b3a87222 (diff) | |
download | luajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.tar.gz luajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.tar.bz2 luajit-ce9e8ed675d1fb7fe8e148a328fe0b892791a5f4.zip |
Fix KBASE for Lua functions below stitched fast functions.
Diffstat (limited to 'src/vm_mips.dasc')
-rw-r--r-- | src/vm_mips.dasc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index 094ffe38..4aaff4b0 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc | |||
@@ -2043,6 +2043,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2043 | | | 2043 | | |
2044 | | addu TMP2, TMP1, TMP2 | 2044 | | addu TMP2, TMP1, TMP2 |
2045 | | lw TRACE:TMP2, 0(TMP2) | 2045 | | lw TRACE:TMP2, 0(TMP2) |
2046 | | beqz TRACE:TMP2, ->cont_nop | ||
2047 | |. nop | ||
2046 | | lhu RD, TRACE:TMP2->link | 2048 | | lhu RD, TRACE:TMP2->link |
2047 | | beq RD, TMP3, ->cont_nop // Blacklisted. | 2049 | | beq RD, TMP3, ->cont_nop // Blacklisted. |
2048 | |. load_got lj_dispatch_stitch | 2050 | |. load_got lj_dispatch_stitch |
@@ -2144,7 +2146,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2144 | | addiu DISPATCH, JGL, -GG_DISP2G-32768 | 2146 | | addiu DISPATCH, JGL, -GG_DISP2G-32768 |
2145 | | sw BASE, L->base | 2147 | | sw BASE, L->base |
2146 | |1: | 2148 | |1: |
2147 | | bltz CRET1, >3 // Check for error from exit. | 2149 | | bltz CRET1, >9 // Check for error from exit. |
2148 | |. lw LFUNC:RB, FRAME_FUNC(BASE) | 2150 | |. lw LFUNC:RB, FRAME_FUNC(BASE) |
2149 | | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float). | 2151 | | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float). |
2150 | | sll MULTRES, CRET1, 3 | 2152 | | sll MULTRES, CRET1, 3 |
@@ -2172,11 +2174,27 @@ static void build_subroutines(BuildCtx *ctx) | |||
2172 | | jr AT | 2174 | | jr AT |
2173 | |. decode_RD8b RD | 2175 | |. decode_RD8b RD |
2174 | |2: | 2176 | |2: |
2177 | | sltiu TMP2, TMP1, (BC_FUNCC+2)*4 // Fast function? | ||
2178 | | bnez TMP2, >3 | ||
2179 | |. lw TMP1, FRAME_PC(BASE) | ||
2180 | | // Check frame below fast function. | ||
2181 | | andi TMP0, TMP1, FRAME_TYPE | ||
2182 | | bnez TMP0, >3 // Trace stitching continuation? | ||
2183 | |. nop | ||
2184 | | // Otherwise set KBASE for Lua function below fast function. | ||
2185 | | lw TMP2, -4(TMP1) | ||
2186 | | decode_RA8a TMP0, TMP2 | ||
2187 | | decode_RA8b TMP0 | ||
2188 | | subu TMP1, BASE, TMP0 | ||
2189 | | lw LFUNC:TMP2, -8+FRAME_FUNC(TMP1) | ||
2190 | | lw TMP1, LFUNC:TMP2->pc | ||
2191 | | lw KBASE, PC2PROTO(k)(TMP1) | ||
2192 | |3: | ||
2175 | | addiu RC, MULTRES, -8 | 2193 | | addiu RC, MULTRES, -8 |
2176 | | jr AT | 2194 | | jr AT |
2177 | |. addu RA, RA, BASE | 2195 | |. addu RA, RA, BASE |
2178 | | | 2196 | | |
2179 | |3: // Rethrow error from the right C frame. | 2197 | |9: // Rethrow error from the right C frame. |
2180 | | load_got lj_err_throw | 2198 | | load_got lj_err_throw |
2181 | | negu CARG2, CRET1 | 2199 | | negu CARG2, CRET1 |
2182 | | call_intern lj_err_throw // (lua_State *L, int errcode) | 2200 | | call_intern lj_err_throw // (lua_State *L, int errcode) |