diff options
author | Mike Pall <mike> | 2011-04-04 01:58:56 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-04-04 02:00:38 +0200 |
commit | 959683c77cea015b21e79d25d510ce3af3a7d0df (patch) | |
tree | da958ee103dee00de34c6b97c7ca638d99a74c1f /src | |
parent | 6511941348ffc5e672b411cd471d01567d3e0c30 (diff) | |
download | luajit-959683c77cea015b21e79d25d510ce3af3a7d0df.tar.gz luajit-959683c77cea015b21e79d25d510ce3af3a7d0df.tar.bz2 luajit-959683c77cea015b21e79d25d510ce3af3a7d0df.zip |
PPC: Minor cleanups of interpreter.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_ppc.dasc | 13 | ||||
-rw-r--r-- | src/buildvm_ppcspe.h | 397 |
2 files changed, 202 insertions, 208 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index db89ac3d..7b5919ba 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -1108,7 +1108,6 @@ static void build_subroutines(BuildCtx *ctx) | |||
1108 | | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0] | 1108 | | evldd CFUNC:TMP0, CFUNC:RB->upvalue[0] |
1109 | | la RA, -8(BASE) | 1109 | | la RA, -8(BASE) |
1110 | #endif | 1110 | #endif |
1111 | | evstdd TAB:CARG1, 0(BASE) | ||
1112 | | evstdd TISNIL, 8(BASE) | 1111 | | evstdd TISNIL, 8(BASE) |
1113 | | li RD, (3+1)*8 | 1112 | | li RD, (3+1)*8 |
1114 | | evstdd CFUNC:TMP0, 0(RA) | 1113 | | evstdd CFUNC:TMP0, 0(RA) |
@@ -1169,9 +1168,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
1169 | | la RA, -8(BASE) | 1168 | | la RA, -8(BASE) |
1170 | #endif | 1169 | #endif |
1171 | | evsplati TMP1, 0 | 1170 | | evsplati TMP1, 0 |
1172 | | evstdd TAB:CARG1, 0(BASE) | ||
1173 | | evstdd TMP1, 8(BASE) | ||
1174 | | li RD, (3+1)*8 | 1171 | | li RD, (3+1)*8 |
1172 | | evstdd TMP1, 8(BASE) | ||
1175 | | evstdd CFUNC:TMP0, 0(RA) | 1173 | | evstdd CFUNC:TMP0, 0(RA) |
1176 | | b ->fff_res | 1174 | | b ->fff_res |
1177 | | | 1175 | | |
@@ -1780,7 +1778,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1780 | | lwz TMP3, CFUNC:RB->f | 1778 | | lwz TMP3, CFUNC:RB->f |
1781 | | add TMP1, BASE, NARGS8:RC | 1779 | | add TMP1, BASE, NARGS8:RC |
1782 | | lwz PC, FRAME_PC(BASE) // Fallback may overwrite PC. | 1780 | | lwz PC, FRAME_PC(BASE) // Fallback may overwrite PC. |
1783 | | addi TMP0, TMP1, 8*LUA_MINSTACK-8 | 1781 | | addi TMP0, TMP1, 8*LUA_MINSTACK |
1784 | | lwz TMP2, L->maxstack | 1782 | | lwz TMP2, L->maxstack |
1785 | | stw PC, SAVE_PC // Redundant (but a defined value). | 1783 | | stw PC, SAVE_PC // Redundant (but a defined value). |
1786 | | cmplw TMP0, TMP2 | 1784 | | cmplw TMP0, TMP2 |
@@ -1796,7 +1794,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1796 | | slwi RD, CRET1, 3 | 1794 | | slwi RD, CRET1, 3 |
1797 | | la RA, -8(BASE) | 1795 | | la RA, -8(BASE) |
1798 | | bgt ->fff_res // Returned nresults+1? | 1796 | | bgt ->fff_res // Returned nresults+1? |
1799 | |1: // Returned 0: retry fast path. | 1797 | |1: // Returned 0 or -1: retry fast path. |
1800 | | lwz TMP0, L->top | 1798 | | lwz TMP0, L->top |
1801 | | lwz LFUNC:RB, FRAME_FUNC(BASE) | 1799 | | lwz LFUNC:RB, FRAME_FUNC(BASE) |
1802 | | sub NARGS8:RC, TMP0, BASE | 1800 | | sub NARGS8:RC, TMP0, BASE |
@@ -1814,11 +1812,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
1814 | | b ->vm_call_dispatch // Resolve again for tailcall. | 1812 | | b ->vm_call_dispatch // Resolve again for tailcall. |
1815 | | | 1813 | | |
1816 | |5: // Grow stack for fallback handler. | 1814 | |5: // Grow stack for fallback handler. |
1817 | | mr CARG1, L | ||
1818 | | li CARG2, LUA_MINSTACK | 1815 | | li CARG2, LUA_MINSTACK |
1819 | | bl extern lj_state_growstack // (lua_State *L, int n) | 1816 | | bl extern lj_state_growstack // (lua_State *L, int n) |
1820 | | lwz BASE, L->base | 1817 | | lwz BASE, L->base |
1821 | | cmpw TMP0, TMP0 // Set 4*cr0+eq. | 1818 | | cmpw TMP0, TMP0 // Set 4*cr0+eq to force retry. |
1822 | | b <1 | 1819 | | b <1 |
1823 | | | 1820 | | |
1824 | |->fff_gcstep: // Call GC step function. | 1821 | |->fff_gcstep: // Call GC step function. |
@@ -3073,7 +3070,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3073 | break; | 3070 | break; |
3074 | 3071 | ||
3075 | case BC_ITERC: | 3072 | case BC_ITERC: |
3076 | | // RA = base*8, (RB = (nresults+1)*8,) RC = (nargs+1)*8 ((2+1)*8) | 3073 | | // RA = base*8, (RB = (nresults+1)*8, RC = (nargs+1)*8 ((2+1)*8)) |
3077 | | subi RA, RA, 24 // evldd doesn't support neg. offsets. | 3074 | | subi RA, RA, 24 // evldd doesn't support neg. offsets. |
3078 | | mr TMP2, BASE | 3075 | | mr TMP2, BASE |
3079 | | evlddx LFUNC:RB, BASE, RA | 3076 | | evlddx LFUNC:RB, BASE, RA |
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h index e3665b35..5afd2379 100644 --- a/src/buildvm_ppcspe.h +++ b/src/buildvm_ppcspe.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define DASM_SECTION_CODE_OP 0 | 12 | #define DASM_SECTION_CODE_OP 0 |
13 | #define DASM_SECTION_CODE_SUB 1 | 13 | #define DASM_SECTION_CODE_SUB 1 |
14 | #define DASM_MAXSECTION 2 | 14 | #define DASM_MAXSECTION 2 |
15 | static const unsigned int build_actionlist[4950] = { | 15 | static const unsigned int build_actionlist[4947] = { |
16 | 0x00010001, | 16 | 0x00010001, |
17 | 0x00060014, | 17 | 0x00060014, |
18 | 0x72000000, | 18 | 0x72000000, |
@@ -1069,7 +1069,6 @@ static const unsigned int build_actionlist[4950] = { | |||
1069 | 0x00090cab, | 1069 | 0x00090cab, |
1070 | 0x3a8efff8, | 1070 | 0x3a8efff8, |
1071 | 0x00000000, | 1071 | 0x00000000, |
1072 | 0x106e0321, | ||
1073 | 0x134e0b21, | 1072 | 0x134e0b21, |
1074 | 0x39800000, | 1073 | 0x39800000, |
1075 | 0x00098200, | 1074 | 0x00098200, |
@@ -1161,10 +1160,9 @@ static const unsigned int build_actionlist[4950] = { | |||
1161 | 0x3a8efff8, | 1160 | 0x3a8efff8, |
1162 | 0x00000000, | 1161 | 0x00000000, |
1163 | 0x11000229, | 1162 | 0x11000229, |
1164 | 0x106e0321, | ||
1165 | 0x110e0b21, | ||
1166 | 0x39800000, | 1163 | 0x39800000, |
1167 | 0x00098200, | 1164 | 0x00098200, |
1165 | 0x110e0b21, | ||
1168 | 0x10140321, | 1166 | 0x10140321, |
1169 | 0x48000000, | 1167 | 0x48000000, |
1170 | 0x00050043, | 1168 | 0x00050043, |
@@ -2493,7 +2491,6 @@ static const unsigned int build_actionlist[4950] = { | |||
2493 | 0x48000000, | 2491 | 0x48000000, |
2494 | 0x00050024, | 2492 | 0x00050024, |
2495 | 0x0006000f, | 2493 | 0x0006000f, |
2496 | 0x7e439378, | ||
2497 | 0x38800000, | 2494 | 0x38800000, |
2498 | 0x00098200, | 2495 | 0x00098200, |
2499 | 0x48000001, | 2496 | 0x48000001, |
@@ -5348,74 +5345,74 @@ static void build_subroutines(BuildCtx *ctx) | |||
5348 | dasm_put(Dst, 1052, Dt8(->upvalue[0])); | 5345 | dasm_put(Dst, 1052, Dt8(->upvalue[0])); |
5349 | #endif | 5346 | #endif |
5350 | dasm_put(Dst, 1056, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8); | 5347 | dasm_put(Dst, 1056, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8); |
5351 | dasm_put(Dst, 1121); | 5348 | dasm_put(Dst, 1120); |
5352 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5349 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5353 | dasm_put(Dst, 1134, Dt6(->metatable), Dt8(->upvalue[0])); | 5350 | dasm_put(Dst, 1133, Dt6(->metatable), Dt8(->upvalue[0])); |
5354 | #else | 5351 | #else |
5355 | dasm_put(Dst, 1143, Dt8(->upvalue[0])); | 5352 | dasm_put(Dst, 1142, Dt8(->upvalue[0])); |
5356 | #endif | 5353 | #endif |
5357 | dasm_put(Dst, 1147, (3+1)*8, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 8+FRAME_PCALL, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 16+FRAME_PCALL, LJ_TTHREAD, Dt1(->status), Dt1(->cframe), Dt1(->top)); | 5354 | dasm_put(Dst, 1146, (3+1)*8, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 8+FRAME_PCALL, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 16+FRAME_PCALL, LJ_TTHREAD, Dt1(->status), Dt1(->cframe), Dt1(->top)); |
5358 | dasm_put(Dst, 1209, LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack)); | 5355 | dasm_put(Dst, 1207, LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack)); |
5359 | dasm_put(Dst, 1272, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); | 5356 | dasm_put(Dst, 1270, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); |
5360 | dasm_put(Dst, 1332, Dt8(->upvalue[0].gcr), Dt1(->status), Dt1(->cframe), Dt1(->top), LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP); | 5357 | dasm_put(Dst, 1330, Dt8(->upvalue[0].gcr), Dt1(->status), Dt1(->cframe), Dt1(->top), LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP); |
5361 | dasm_put(Dst, 1391, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); | 5358 | dasm_put(Dst, 1389, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); |
5362 | dasm_put(Dst, 1448, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); | 5359 | dasm_put(Dst, 1446, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); |
5363 | dasm_put(Dst, 1513); | 5360 | dasm_put(Dst, 1511); |
5364 | dasm_put(Dst, 1582); | 5361 | dasm_put(Dst, 1580); |
5365 | dasm_put(Dst, 1645); | 5362 | dasm_put(Dst, 1643); |
5366 | dasm_put(Dst, 1710); | 5363 | dasm_put(Dst, 1708); |
5367 | dasm_put(Dst, 1780, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); | 5364 | dasm_put(Dst, 1778, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); |
5368 | dasm_put(Dst, 1852, Dt5(->len)); | 5365 | dasm_put(Dst, 1850, Dt5(->len)); |
5369 | dasm_put(Dst, 1919, Dt5(->len), (0+1)*8, Dt5([1]), (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmptv), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5366 | dasm_put(Dst, 1917, Dt5(->len), (0+1)*8, Dt5([1]), (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmptv), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5370 | dasm_put(Dst, 1979, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5367 | dasm_put(Dst, 1977, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5371 | dasm_put(Dst, 2045, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5368 | dasm_put(Dst, 2043, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5372 | dasm_put(Dst, 2104, DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); | 5369 | dasm_put(Dst, 2102, DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); |
5373 | dasm_put(Dst, 2163, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); | 5370 | dasm_put(Dst, 2161, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); |
5374 | dasm_put(Dst, 2230); | 5371 | dasm_put(Dst, 2228); |
5375 | dasm_put(Dst, 2301); | 5372 | dasm_put(Dst, 2299); |
5376 | dasm_put(Dst, 2389, Dt8(->f), 8*LUA_MINSTACK-8, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); | 5373 | dasm_put(Dst, 2387, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); |
5377 | dasm_put(Dst, 2468, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); | 5374 | dasm_put(Dst, 2466, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); |
5378 | #if LJ_HASJIT | 5375 | #if LJ_HASJIT |
5379 | dasm_put(Dst, 2511); | 5376 | dasm_put(Dst, 2508); |
5380 | #endif | 5377 | #endif |
5381 | dasm_put(Dst, 2513, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); | 5378 | dasm_put(Dst, 2510, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); |
5382 | dasm_put(Dst, 2560, GG_DISP2STATIC); | 5379 | dasm_put(Dst, 2557, GG_DISP2STATIC); |
5383 | #if LJ_HASJIT | 5380 | #if LJ_HASJIT |
5384 | dasm_put(Dst, 2578); | 5381 | dasm_put(Dst, 2575); |
5385 | #endif | 5382 | #endif |
5386 | dasm_put(Dst, 2580); | 5383 | dasm_put(Dst, 2577); |
5387 | #if LJ_HASJIT | 5384 | #if LJ_HASJIT |
5388 | dasm_put(Dst, 2583); | 5385 | dasm_put(Dst, 2580); |
5389 | #endif | 5386 | #endif |
5390 | dasm_put(Dst, 2586); | 5387 | dasm_put(Dst, 2583); |
5391 | #if LJ_HASJIT | 5388 | #if LJ_HASJIT |
5392 | dasm_put(Dst, 2588); | 5389 | dasm_put(Dst, 2585); |
5393 | #endif | 5390 | #endif |
5394 | dasm_put(Dst, 2591, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); | 5391 | dasm_put(Dst, 2588, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); |
5395 | #if LJ_HASJIT | 5392 | #if LJ_HASJIT |
5396 | dasm_put(Dst, 2613); | 5393 | dasm_put(Dst, 2610); |
5397 | #endif | 5394 | #endif |
5398 | dasm_put(Dst, 2615); | 5395 | dasm_put(Dst, 2612); |
5399 | #if LJ_HASJIT | 5396 | #if LJ_HASJIT |
5400 | dasm_put(Dst, 2617); | 5397 | dasm_put(Dst, 2614); |
5401 | #endif | 5398 | #endif |
5402 | dasm_put(Dst, 2619); | 5399 | dasm_put(Dst, 2616); |
5403 | #if LJ_HASJIT | 5400 | #if LJ_HASJIT |
5404 | dasm_put(Dst, 2696); | 5401 | dasm_put(Dst, 2693); |
5405 | #else | 5402 | #else |
5406 | dasm_put(Dst, 2719); | 5403 | dasm_put(Dst, 2716); |
5407 | #endif | 5404 | #endif |
5408 | dasm_put(Dst, 2722); | 5405 | dasm_put(Dst, 2719); |
5409 | #if LJ_HASJIT | 5406 | #if LJ_HASJIT |
5410 | dasm_put(Dst, 2724); | 5407 | dasm_put(Dst, 2721); |
5411 | #endif | 5408 | #endif |
5412 | dasm_put(Dst, 2726); | 5409 | dasm_put(Dst, 2723); |
5413 | #if LJ_HASJIT | 5410 | #if LJ_HASJIT |
5414 | dasm_put(Dst, 2728); | 5411 | dasm_put(Dst, 2725); |
5415 | #endif | 5412 | #endif |
5416 | dasm_put(Dst, 2730); | 5413 | dasm_put(Dst, 2727); |
5417 | #if LJ_HASFFI | 5414 | #if LJ_HASFFI |
5418 | dasm_put(Dst, 2793); | 5415 | dasm_put(Dst, 2790); |
5419 | #endif | 5416 | #endif |
5420 | } | 5417 | } |
5421 | 5418 | ||
@@ -5423,7 +5420,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
5423 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | 5420 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) |
5424 | { | 5421 | { |
5425 | int vk = 0; | 5422 | int vk = 0; |
5426 | dasm_put(Dst, 2795, defop); | 5423 | dasm_put(Dst, 2792, defop); |
5427 | 5424 | ||
5428 | switch (op) { | 5425 | switch (op) { |
5429 | 5426 | ||
@@ -5432,112 +5429,112 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5432 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ | 5429 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ |
5433 | 5430 | ||
5434 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | 5431 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: |
5435 | dasm_put(Dst, 2797, -(BCBIAS_J*4 >> 16)); | 5432 | dasm_put(Dst, 2794, -(BCBIAS_J*4 >> 16)); |
5436 | if (op == BC_ISLE || op == BC_ISGT) { | 5433 | if (op == BC_ISLE || op == BC_ISGT) { |
5437 | dasm_put(Dst, 2811); | 5434 | dasm_put(Dst, 2808); |
5438 | } | 5435 | } |
5439 | if (op == BC_ISLT || op == BC_ISLE) { | 5436 | if (op == BC_ISLT || op == BC_ISLE) { |
5440 | dasm_put(Dst, 2814); | 5437 | dasm_put(Dst, 2811); |
5441 | } else { | 5438 | } else { |
5442 | dasm_put(Dst, 2816); | 5439 | dasm_put(Dst, 2813); |
5443 | } | 5440 | } |
5444 | dasm_put(Dst, 2818); | 5441 | dasm_put(Dst, 2815); |
5445 | break; | 5442 | break; |
5446 | 5443 | ||
5447 | case BC_ISEQV: case BC_ISNEV: | 5444 | case BC_ISEQV: case BC_ISNEV: |
5448 | vk = op == BC_ISEQV; | 5445 | vk = op == BC_ISEQV; |
5449 | dasm_put(Dst, 2829, -(BCBIAS_J*4 >> 16)); | 5446 | dasm_put(Dst, 2826, -(BCBIAS_J*4 >> 16)); |
5450 | if (vk) { | 5447 | if (vk) { |
5451 | dasm_put(Dst, 2843); | 5448 | dasm_put(Dst, 2840); |
5452 | } else { | 5449 | } else { |
5453 | dasm_put(Dst, 2845); | 5450 | dasm_put(Dst, 2842); |
5454 | } | 5451 | } |
5455 | dasm_put(Dst, 2847, ~LJ_TISPRI, ~LJ_TISTABUD); | 5452 | dasm_put(Dst, 2844, ~LJ_TISPRI, ~LJ_TISTABUD); |
5456 | if (vk) { | 5453 | if (vk) { |
5457 | dasm_put(Dst, 2869); | 5454 | dasm_put(Dst, 2866); |
5458 | } else { | 5455 | } else { |
5459 | dasm_put(Dst, 2871); | 5456 | dasm_put(Dst, 2868); |
5460 | } | 5457 | } |
5461 | dasm_put(Dst, 2873); | 5458 | dasm_put(Dst, 2870); |
5462 | if (vk) { | 5459 | if (vk) { |
5463 | dasm_put(Dst, 2875); | 5460 | dasm_put(Dst, 2872); |
5464 | } else { | 5461 | } else { |
5465 | dasm_put(Dst, 2877); | 5462 | dasm_put(Dst, 2874); |
5466 | } | 5463 | } |
5467 | dasm_put(Dst, 2879, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); | 5464 | dasm_put(Dst, 2876, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); |
5468 | break; | 5465 | break; |
5469 | 5466 | ||
5470 | case BC_ISEQS: case BC_ISNES: | 5467 | case BC_ISEQS: case BC_ISNES: |
5471 | vk = op == BC_ISEQS; | 5468 | vk = op == BC_ISEQS; |
5472 | dasm_put(Dst, 2900, 32-1, -(BCBIAS_J*4 >> 16)); | 5469 | dasm_put(Dst, 2897, 32-1, -(BCBIAS_J*4 >> 16)); |
5473 | if (vk) { | 5470 | if (vk) { |
5474 | dasm_put(Dst, 2914); | 5471 | dasm_put(Dst, 2911); |
5475 | } else { | 5472 | } else { |
5476 | dasm_put(Dst, 2916); | 5473 | dasm_put(Dst, 2913); |
5477 | } | 5474 | } |
5478 | dasm_put(Dst, 2918); | 5475 | dasm_put(Dst, 2915); |
5479 | break; | 5476 | break; |
5480 | 5477 | ||
5481 | case BC_ISEQN: case BC_ISNEN: | 5478 | case BC_ISEQN: case BC_ISNEN: |
5482 | vk = op == BC_ISEQN; | 5479 | vk = op == BC_ISEQN; |
5483 | dasm_put(Dst, 2929, -(BCBIAS_J*4 >> 16)); | 5480 | dasm_put(Dst, 2926, -(BCBIAS_J*4 >> 16)); |
5484 | if (vk) { | 5481 | if (vk) { |
5485 | dasm_put(Dst, 2943); | 5482 | dasm_put(Dst, 2940); |
5486 | } else { | 5483 | } else { |
5487 | dasm_put(Dst, 2946); | 5484 | dasm_put(Dst, 2943); |
5488 | } | 5485 | } |
5489 | dasm_put(Dst, 2948); | 5486 | dasm_put(Dst, 2945); |
5490 | if (!vk) { | 5487 | if (!vk) { |
5491 | dasm_put(Dst, 2960); | 5488 | dasm_put(Dst, 2957); |
5492 | } | 5489 | } |
5493 | break; | 5490 | break; |
5494 | 5491 | ||
5495 | case BC_ISEQP: case BC_ISNEP: | 5492 | case BC_ISEQP: case BC_ISNEP: |
5496 | vk = op == BC_ISEQP; | 5493 | vk = op == BC_ISEQP; |
5497 | dasm_put(Dst, 2966, 32-3, -(BCBIAS_J*4 >> 16)); | 5494 | dasm_put(Dst, 2963, 32-3, -(BCBIAS_J*4 >> 16)); |
5498 | if (vk) { | 5495 | if (vk) { |
5499 | dasm_put(Dst, 2978); | 5496 | dasm_put(Dst, 2975); |
5500 | } else { | 5497 | } else { |
5501 | dasm_put(Dst, 2980); | 5498 | dasm_put(Dst, 2977); |
5502 | } | 5499 | } |
5503 | dasm_put(Dst, 2982); | 5500 | dasm_put(Dst, 2979); |
5504 | break; | 5501 | break; |
5505 | 5502 | ||
5506 | /* -- Unary test and copy ops ------------------------------------------- */ | 5503 | /* -- Unary test and copy ops ------------------------------------------- */ |
5507 | 5504 | ||
5508 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | 5505 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: |
5509 | dasm_put(Dst, 2993); | 5506 | dasm_put(Dst, 2990); |
5510 | if (op == BC_IST || op == BC_ISF) { | 5507 | if (op == BC_IST || op == BC_ISF) { |
5511 | dasm_put(Dst, 2999, -(BCBIAS_J*4 >> 16)); | 5508 | dasm_put(Dst, 2996, -(BCBIAS_J*4 >> 16)); |
5512 | if (op == BC_IST) { | 5509 | if (op == BC_IST) { |
5513 | dasm_put(Dst, 3004); | 5510 | dasm_put(Dst, 3001); |
5514 | } else { | 5511 | } else { |
5515 | dasm_put(Dst, 3006); | 5512 | dasm_put(Dst, 3003); |
5516 | } | 5513 | } |
5517 | } else { | 5514 | } else { |
5518 | if (op == BC_ISTC) { | 5515 | if (op == BC_ISTC) { |
5519 | dasm_put(Dst, 3008); | 5516 | dasm_put(Dst, 3005); |
5520 | } else { | 5517 | } else { |
5521 | dasm_put(Dst, 3011); | 5518 | dasm_put(Dst, 3008); |
5522 | } | 5519 | } |
5523 | dasm_put(Dst, 3014, -(BCBIAS_J*4 >> 16)); | 5520 | dasm_put(Dst, 3011, -(BCBIAS_J*4 >> 16)); |
5524 | } | 5521 | } |
5525 | dasm_put(Dst, 3021); | 5522 | dasm_put(Dst, 3018); |
5526 | break; | 5523 | break; |
5527 | 5524 | ||
5528 | /* -- Unary ops --------------------------------------------------------- */ | 5525 | /* -- Unary ops --------------------------------------------------------- */ |
5529 | 5526 | ||
5530 | case BC_MOV: | 5527 | case BC_MOV: |
5531 | dasm_put(Dst, 3032); | 5528 | dasm_put(Dst, 3029); |
5532 | break; | 5529 | break; |
5533 | case BC_NOT: | 5530 | case BC_NOT: |
5534 | dasm_put(Dst, 3045, LJ_TTRUE); | 5531 | dasm_put(Dst, 3042, LJ_TTRUE); |
5535 | break; | 5532 | break; |
5536 | case BC_UNM: | 5533 | case BC_UNM: |
5537 | dasm_put(Dst, 3061); | 5534 | dasm_put(Dst, 3058); |
5538 | break; | 5535 | break; |
5539 | case BC_LEN: | 5536 | case BC_LEN: |
5540 | dasm_put(Dst, 3078, Dt5(->len)); | 5537 | dasm_put(Dst, 3075, Dt5(->len)); |
5541 | break; | 5538 | break; |
5542 | 5539 | ||
5543 | /* -- Binary ops -------------------------------------------------------- */ | 5540 | /* -- Binary ops -------------------------------------------------------- */ |
@@ -5547,262 +5544,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5547 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5544 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5548 | switch (vk) { | 5545 | switch (vk) { |
5549 | case 0: | 5546 | case 0: |
5550 | dasm_put(Dst, 3106); | 5547 | dasm_put(Dst, 3103); |
5551 | break; | 5548 | break; |
5552 | case 1: | 5549 | case 1: |
5553 | dasm_put(Dst, 3112); | 5550 | dasm_put(Dst, 3109); |
5554 | break; | 5551 | break; |
5555 | default: | 5552 | default: |
5556 | dasm_put(Dst, 3118); | 5553 | dasm_put(Dst, 3115); |
5557 | break; | 5554 | break; |
5558 | } | 5555 | } |
5559 | dasm_put(Dst, 3125); | 5556 | dasm_put(Dst, 3122); |
5560 | break; | 5557 | break; |
5561 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | 5558 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: |
5562 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5559 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5563 | switch (vk) { | 5560 | switch (vk) { |
5564 | case 0: | 5561 | case 0: |
5565 | dasm_put(Dst, 3138); | 5562 | dasm_put(Dst, 3135); |
5566 | break; | 5563 | break; |
5567 | case 1: | 5564 | case 1: |
5568 | dasm_put(Dst, 3144); | 5565 | dasm_put(Dst, 3141); |
5569 | break; | 5566 | break; |
5570 | default: | 5567 | default: |
5571 | dasm_put(Dst, 3150); | 5568 | dasm_put(Dst, 3147); |
5572 | break; | 5569 | break; |
5573 | } | 5570 | } |
5574 | dasm_put(Dst, 3157); | 5571 | dasm_put(Dst, 3154); |
5575 | break; | 5572 | break; |
5576 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | 5573 | case BC_MULVN: case BC_MULNV: case BC_MULVV: |
5577 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5574 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5578 | switch (vk) { | 5575 | switch (vk) { |
5579 | case 0: | 5576 | case 0: |
5580 | dasm_put(Dst, 3170); | 5577 | dasm_put(Dst, 3167); |
5581 | break; | 5578 | break; |
5582 | case 1: | 5579 | case 1: |
5583 | dasm_put(Dst, 3176); | 5580 | dasm_put(Dst, 3173); |
5584 | break; | 5581 | break; |
5585 | default: | 5582 | default: |
5586 | dasm_put(Dst, 3182); | 5583 | dasm_put(Dst, 3179); |
5587 | break; | 5584 | break; |
5588 | } | 5585 | } |
5589 | dasm_put(Dst, 3189); | 5586 | dasm_put(Dst, 3186); |
5590 | break; | 5587 | break; |
5591 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | 5588 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: |
5592 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5589 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5593 | switch (vk) { | 5590 | switch (vk) { |
5594 | case 0: | 5591 | case 0: |
5595 | dasm_put(Dst, 3202); | 5592 | dasm_put(Dst, 3199); |
5596 | break; | 5593 | break; |
5597 | case 1: | 5594 | case 1: |
5598 | dasm_put(Dst, 3208); | 5595 | dasm_put(Dst, 3205); |
5599 | break; | 5596 | break; |
5600 | default: | 5597 | default: |
5601 | dasm_put(Dst, 3214); | 5598 | dasm_put(Dst, 3211); |
5602 | break; | 5599 | break; |
5603 | } | 5600 | } |
5604 | dasm_put(Dst, 3221); | 5601 | dasm_put(Dst, 3218); |
5605 | break; | 5602 | break; |
5606 | case BC_MODVN: | 5603 | case BC_MODVN: |
5607 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5604 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5608 | switch (vk) { | 5605 | switch (vk) { |
5609 | case 0: | 5606 | case 0: |
5610 | dasm_put(Dst, 3234); | 5607 | dasm_put(Dst, 3231); |
5611 | break; | 5608 | break; |
5612 | case 1: | 5609 | case 1: |
5613 | dasm_put(Dst, 3240); | 5610 | dasm_put(Dst, 3237); |
5614 | break; | 5611 | break; |
5615 | default: | 5612 | default: |
5616 | dasm_put(Dst, 3246); | 5613 | dasm_put(Dst, 3243); |
5617 | break; | 5614 | break; |
5618 | } | 5615 | } |
5619 | dasm_put(Dst, 3253); | 5616 | dasm_put(Dst, 3250); |
5620 | break; | 5617 | break; |
5621 | case BC_MODNV: case BC_MODVV: | 5618 | case BC_MODNV: case BC_MODVV: |
5622 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5619 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5623 | switch (vk) { | 5620 | switch (vk) { |
5624 | case 0: | 5621 | case 0: |
5625 | dasm_put(Dst, 3271); | 5622 | dasm_put(Dst, 3268); |
5626 | break; | 5623 | break; |
5627 | case 1: | 5624 | case 1: |
5628 | dasm_put(Dst, 3277); | 5625 | dasm_put(Dst, 3274); |
5629 | break; | 5626 | break; |
5630 | default: | 5627 | default: |
5631 | dasm_put(Dst, 3283); | 5628 | dasm_put(Dst, 3280); |
5632 | break; | 5629 | break; |
5633 | } | 5630 | } |
5634 | dasm_put(Dst, 3290); | 5631 | dasm_put(Dst, 3287); |
5635 | break; | 5632 | break; |
5636 | case BC_POW: | 5633 | case BC_POW: |
5637 | dasm_put(Dst, 3293); | 5634 | dasm_put(Dst, 3290); |
5638 | break; | 5635 | break; |
5639 | 5636 | ||
5640 | case BC_CAT: | 5637 | case BC_CAT: |
5641 | dasm_put(Dst, 3315, Dt1(->base), 32-3, Dt1(->base)); | 5638 | dasm_put(Dst, 3312, Dt1(->base), 32-3, Dt1(->base)); |
5642 | break; | 5639 | break; |
5643 | 5640 | ||
5644 | /* -- Constant ops ------------------------------------------------------ */ | 5641 | /* -- Constant ops ------------------------------------------------------ */ |
5645 | 5642 | ||
5646 | case BC_KSTR: | 5643 | case BC_KSTR: |
5647 | dasm_put(Dst, 3345, 32-1); | 5644 | dasm_put(Dst, 3342, 32-1); |
5648 | break; | 5645 | break; |
5649 | case BC_KCDATA: | 5646 | case BC_KCDATA: |
5650 | #if LJ_HASFFI | 5647 | #if LJ_HASFFI |
5651 | dasm_put(Dst, 3362, 32-1, LJ_TCDATA); | 5648 | dasm_put(Dst, 3359, 32-1, LJ_TCDATA); |
5652 | #endif | 5649 | #endif |
5653 | break; | 5650 | break; |
5654 | case BC_KSHORT: | 5651 | case BC_KSHORT: |
5655 | dasm_put(Dst, 3381, 32-3); | 5652 | dasm_put(Dst, 3378, 32-3); |
5656 | break; | 5653 | break; |
5657 | case BC_KNUM: | 5654 | case BC_KNUM: |
5658 | dasm_put(Dst, 3397); | 5655 | dasm_put(Dst, 3394); |
5659 | break; | 5656 | break; |
5660 | case BC_KPRI: | 5657 | case BC_KPRI: |
5661 | dasm_put(Dst, 3410, 32-3); | 5658 | dasm_put(Dst, 3407, 32-3); |
5662 | break; | 5659 | break; |
5663 | case BC_KNIL: | 5660 | case BC_KNIL: |
5664 | dasm_put(Dst, 3425); | 5661 | dasm_put(Dst, 3422); |
5665 | break; | 5662 | break; |
5666 | 5663 | ||
5667 | /* -- Upvalue and function ops ------------------------------------------ */ | 5664 | /* -- Upvalue and function ops ------------------------------------------ */ |
5668 | 5665 | ||
5669 | case BC_UGET: | 5666 | case BC_UGET: |
5670 | dasm_put(Dst, 3444, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5667 | dasm_put(Dst, 3441, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5671 | break; | 5668 | break; |
5672 | case BC_USETV: | 5669 | case BC_USETV: |
5673 | dasm_put(Dst, 3465, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -LJ_TISNUM, LJ_TISGCV - LJ_TISNUM, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); | 5670 | dasm_put(Dst, 3462, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -LJ_TISNUM, LJ_TISGCV - LJ_TISNUM, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); |
5674 | break; | 5671 | break; |
5675 | case BC_USETS: | 5672 | case BC_USETS: |
5676 | dasm_put(Dst, 3517, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); | 5673 | dasm_put(Dst, 3514, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); |
5677 | break; | 5674 | break; |
5678 | case BC_USETN: | 5675 | case BC_USETN: |
5679 | dasm_put(Dst, 3566, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5676 | dasm_put(Dst, 3563, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5680 | break; | 5677 | break; |
5681 | case BC_USETP: | 5678 | case BC_USETP: |
5682 | dasm_put(Dst, 3587, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); | 5679 | dasm_put(Dst, 3584, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); |
5683 | break; | 5680 | break; |
5684 | 5681 | ||
5685 | case BC_UCLO: | 5682 | case BC_UCLO: |
5686 | dasm_put(Dst, 3610, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); | 5683 | dasm_put(Dst, 3607, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); |
5687 | break; | 5684 | break; |
5688 | 5685 | ||
5689 | case BC_FNEW: | 5686 | case BC_FNEW: |
5690 | dasm_put(Dst, 3640, 32-1, Dt1(->base), Dt1(->base)); | 5687 | dasm_put(Dst, 3637, 32-1, Dt1(->base), Dt1(->base)); |
5691 | break; | 5688 | break; |
5692 | 5689 | ||
5693 | /* -- Table ops --------------------------------------------------------- */ | 5690 | /* -- Table ops --------------------------------------------------------- */ |
5694 | 5691 | ||
5695 | case BC_TNEW: | 5692 | case BC_TNEW: |
5696 | case BC_TDUP: | 5693 | case BC_TDUP: |
5697 | dasm_put(Dst, 3666, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); | 5694 | dasm_put(Dst, 3663, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); |
5698 | if (op == BC_TNEW) { | 5695 | if (op == BC_TNEW) { |
5699 | dasm_put(Dst, 3679); | 5696 | dasm_put(Dst, 3676); |
5700 | } else { | 5697 | } else { |
5701 | dasm_put(Dst, 3687, 32-1); | 5698 | dasm_put(Dst, 3684, 32-1); |
5702 | } | 5699 | } |
5703 | dasm_put(Dst, 3694, Dt1(->base)); | 5700 | dasm_put(Dst, 3691, Dt1(->base)); |
5704 | break; | 5701 | break; |
5705 | 5702 | ||
5706 | case BC_GGET: | 5703 | case BC_GGET: |
5707 | case BC_GSET: | 5704 | case BC_GSET: |
5708 | dasm_put(Dst, 3717, 32-1, Dt7(->env)); | 5705 | dasm_put(Dst, 3714, 32-1, Dt7(->env)); |
5709 | if (op == BC_GGET) { | 5706 | if (op == BC_GGET) { |
5710 | dasm_put(Dst, 3725); | 5707 | dasm_put(Dst, 3722); |
5711 | } else { | 5708 | } else { |
5712 | dasm_put(Dst, 3728); | 5709 | dasm_put(Dst, 3725); |
5713 | } | 5710 | } |
5714 | break; | 5711 | break; |
5715 | 5712 | ||
5716 | case BC_TGETV: | 5713 | case BC_TGETV: |
5717 | dasm_put(Dst, 3731, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5714 | dasm_put(Dst, 3728, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5718 | break; | 5715 | break; |
5719 | case BC_TGETS: | 5716 | case BC_TGETS: |
5720 | dasm_put(Dst, 3789, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5717 | dasm_put(Dst, 3786, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5721 | dasm_put(Dst, 3853); | 5718 | dasm_put(Dst, 3850); |
5722 | break; | 5719 | break; |
5723 | case BC_TGETB: | 5720 | case BC_TGETB: |
5724 | dasm_put(Dst, 3858, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5721 | dasm_put(Dst, 3855, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5725 | break; | 5722 | break; |
5726 | 5723 | ||
5727 | case BC_TSETV: | 5724 | case BC_TSETV: |
5728 | dasm_put(Dst, 3902, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 5725 | dasm_put(Dst, 3899, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
5729 | dasm_put(Dst, 3969, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5726 | dasm_put(Dst, 3966, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5730 | break; | 5727 | break; |
5731 | case BC_TSETS: | 5728 | case BC_TSETS: |
5732 | dasm_put(Dst, 3981, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); | 5729 | dasm_put(Dst, 3978, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); |
5733 | dasm_put(Dst, 4042, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); | 5730 | dasm_put(Dst, 4039, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); |
5734 | dasm_put(Dst, 4093, Dt6(->marked), Dt6(->gclist)); | 5731 | dasm_put(Dst, 4090, Dt6(->marked), Dt6(->gclist)); |
5735 | break; | 5732 | break; |
5736 | case BC_TSETB: | 5733 | case BC_TSETB: |
5737 | dasm_put(Dst, 4100, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); | 5734 | dasm_put(Dst, 4097, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); |
5738 | dasm_put(Dst, 4160, Dt6(->gclist)); | 5735 | dasm_put(Dst, 4157, Dt6(->gclist)); |
5739 | break; | 5736 | break; |
5740 | 5737 | ||
5741 | case BC_TSETM: | 5738 | case BC_TSETM: |
5742 | dasm_put(Dst, 4165, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5739 | dasm_put(Dst, 4162, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5743 | dasm_put(Dst, 4234); | 5740 | dasm_put(Dst, 4231); |
5744 | break; | 5741 | break; |
5745 | 5742 | ||
5746 | /* -- Calls and vararg handling ----------------------------------------- */ | 5743 | /* -- Calls and vararg handling ----------------------------------------- */ |
5747 | 5744 | ||
5748 | case BC_CALLM: | 5745 | case BC_CALLM: |
5749 | dasm_put(Dst, 4237); | 5746 | dasm_put(Dst, 4234); |
5750 | break; | 5747 | break; |
5751 | case BC_CALL: | 5748 | case BC_CALL: |
5752 | dasm_put(Dst, 4239, Dt7(->pc)); | 5749 | dasm_put(Dst, 4236, Dt7(->pc)); |
5753 | break; | 5750 | break; |
5754 | 5751 | ||
5755 | case BC_CALLMT: | 5752 | case BC_CALLMT: |
5756 | dasm_put(Dst, 4259); | 5753 | dasm_put(Dst, 4256); |
5757 | break; | 5754 | break; |
5758 | case BC_CALLT: | 5755 | case BC_CALLT: |
5759 | dasm_put(Dst, 4261, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5756 | dasm_put(Dst, 4258, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5760 | dasm_put(Dst, 4326, FRAME_TYPE); | 5757 | dasm_put(Dst, 4323, FRAME_TYPE); |
5761 | break; | 5758 | break; |
5762 | 5759 | ||
5763 | case BC_ITERC: | 5760 | case BC_ITERC: |
5764 | dasm_put(Dst, 4333, Dt7(->pc)); | 5761 | dasm_put(Dst, 4330, Dt7(->pc)); |
5765 | break; | 5762 | break; |
5766 | 5763 | ||
5767 | case BC_ITERN: | 5764 | case BC_ITERN: |
5768 | #if LJ_HASJIT | 5765 | #if LJ_HASJIT |
5769 | #endif | 5766 | #endif |
5770 | dasm_put(Dst, 4359, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); | 5767 | dasm_put(Dst, 4356, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); |
5771 | dasm_put(Dst, 4438); | 5768 | dasm_put(Dst, 4435); |
5772 | break; | 5769 | break; |
5773 | 5770 | ||
5774 | case BC_ISNEXT: | 5771 | case BC_ISNEXT: |
5775 | dasm_put(Dst, 4442, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); | 5772 | dasm_put(Dst, 4439, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); |
5776 | break; | 5773 | break; |
5777 | 5774 | ||
5778 | case BC_VARG: | 5775 | case BC_VARG: |
5779 | dasm_put(Dst, 4493, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); | 5776 | dasm_put(Dst, 4490, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); |
5780 | dasm_put(Dst, 4573); | 5777 | dasm_put(Dst, 4570); |
5781 | break; | 5778 | break; |
5782 | 5779 | ||
5783 | /* -- Returns ----------------------------------------------------------- */ | 5780 | /* -- Returns ----------------------------------------------------------- */ |
5784 | 5781 | ||
5785 | case BC_RETM: | 5782 | case BC_RETM: |
5786 | dasm_put(Dst, 4579); | 5783 | dasm_put(Dst, 4576); |
5787 | break; | 5784 | break; |
5788 | 5785 | ||
5789 | case BC_RET: | 5786 | case BC_RET: |
5790 | dasm_put(Dst, 4581, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5787 | dasm_put(Dst, 4578, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5791 | break; | 5788 | break; |
5792 | 5789 | ||
5793 | case BC_RET0: case BC_RET1: | 5790 | case BC_RET0: case BC_RET1: |
5794 | dasm_put(Dst, 4651, FRAME_TYPE, FRAME_VARG); | 5791 | dasm_put(Dst, 4648, FRAME_TYPE, FRAME_VARG); |
5795 | if (op == BC_RET1) { | 5792 | if (op == BC_RET1) { |
5796 | dasm_put(Dst, 4664); | 5793 | dasm_put(Dst, 4661); |
5797 | } | 5794 | } |
5798 | dasm_put(Dst, 4667, Dt7(->pc), PC2PROTO(k)); | 5795 | dasm_put(Dst, 4664, Dt7(->pc), PC2PROTO(k)); |
5799 | break; | 5796 | break; |
5800 | 5797 | ||
5801 | /* -- Loops and branches ------------------------------------------------ */ | 5798 | /* -- Loops and branches ------------------------------------------------ */ |
5802 | 5799 | ||
5803 | case BC_FORL: | 5800 | case BC_FORL: |
5804 | #if LJ_HASJIT | 5801 | #if LJ_HASJIT |
5805 | dasm_put(Dst, 4695); | 5802 | dasm_put(Dst, 4692); |
5806 | #endif | 5803 | #endif |
5807 | break; | 5804 | break; |
5808 | 5805 | ||
@@ -5814,35 +5811,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5814 | case BC_FORI: | 5811 | case BC_FORI: |
5815 | case BC_IFORL: | 5812 | case BC_IFORL: |
5816 | vk = (op == BC_IFORL || op == BC_JFORL); | 5813 | vk = (op == BC_IFORL || op == BC_JFORL); |
5817 | dasm_put(Dst, 4697, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); | 5814 | dasm_put(Dst, 4694, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); |
5818 | if (!vk) { | 5815 | if (!vk) { |
5819 | dasm_put(Dst, 4705); | 5816 | dasm_put(Dst, 4702); |
5820 | } | 5817 | } |
5821 | if (vk) { | 5818 | if (vk) { |
5822 | dasm_put(Dst, 4713, FORL_IDX*8); | 5819 | dasm_put(Dst, 4710, FORL_IDX*8); |
5823 | } | 5820 | } |
5824 | dasm_put(Dst, 4717, FORL_EXT*8); | 5821 | dasm_put(Dst, 4714, FORL_EXT*8); |
5825 | if (op != BC_JFORL) { | 5822 | if (op != BC_JFORL) { |
5826 | dasm_put(Dst, 4725, 32-1); | 5823 | dasm_put(Dst, 4722, 32-1); |
5827 | if (op == BC_JFORI) { | 5824 | if (op == BC_JFORI) { |
5828 | dasm_put(Dst, 4729, -(BCBIAS_J*4 >> 16)); | 5825 | dasm_put(Dst, 4726, -(BCBIAS_J*4 >> 16)); |
5829 | } else { | 5826 | } else { |
5830 | dasm_put(Dst, 4732, -(BCBIAS_J*4 >> 16)); | 5827 | dasm_put(Dst, 4729, -(BCBIAS_J*4 >> 16)); |
5831 | } | 5828 | } |
5832 | } | 5829 | } |
5833 | if (op == BC_FORI) { | 5830 | if (op == BC_FORI) { |
5834 | dasm_put(Dst, 4735); | 5831 | dasm_put(Dst, 4732); |
5835 | } else if (op == BC_IFORL) { | 5832 | } else if (op == BC_IFORL) { |
5836 | dasm_put(Dst, 4737); | 5833 | dasm_put(Dst, 4734); |
5837 | } else { | 5834 | } else { |
5838 | dasm_put(Dst, 4739, BC_JLOOP); | 5835 | dasm_put(Dst, 4736, BC_JLOOP); |
5839 | } | 5836 | } |
5840 | dasm_put(Dst, 4742); | 5837 | dasm_put(Dst, 4739); |
5841 | break; | 5838 | break; |
5842 | 5839 | ||
5843 | case BC_ITERL: | 5840 | case BC_ITERL: |
5844 | #if LJ_HASJIT | 5841 | #if LJ_HASJIT |
5845 | dasm_put(Dst, 4757); | 5842 | dasm_put(Dst, 4754); |
5846 | #endif | 5843 | #endif |
5847 | break; | 5844 | break; |
5848 | 5845 | ||
@@ -5851,40 +5848,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5851 | break; | 5848 | break; |
5852 | #endif | 5849 | #endif |
5853 | case BC_IITERL: | 5850 | case BC_IITERL: |
5854 | dasm_put(Dst, 4759); | 5851 | dasm_put(Dst, 4756); |
5855 | if (op == BC_JITERL) { | 5852 | if (op == BC_JITERL) { |
5856 | dasm_put(Dst, 4765); | 5853 | dasm_put(Dst, 4762); |
5857 | } else { | 5854 | } else { |
5858 | dasm_put(Dst, 4767, 32-1, -(BCBIAS_J*4 >> 16)); | 5855 | dasm_put(Dst, 4764, 32-1, -(BCBIAS_J*4 >> 16)); |
5859 | } | 5856 | } |
5860 | dasm_put(Dst, 4774); | 5857 | dasm_put(Dst, 4771); |
5861 | break; | 5858 | break; |
5862 | 5859 | ||
5863 | case BC_LOOP: | 5860 | case BC_LOOP: |
5864 | #if LJ_HASJIT | 5861 | #if LJ_HASJIT |
5865 | dasm_put(Dst, 4786); | 5862 | dasm_put(Dst, 4783); |
5866 | #endif | 5863 | #endif |
5867 | break; | 5864 | break; |
5868 | 5865 | ||
5869 | case BC_ILOOP: | 5866 | case BC_ILOOP: |
5870 | dasm_put(Dst, 4788); | 5867 | dasm_put(Dst, 4785); |
5871 | break; | 5868 | break; |
5872 | 5869 | ||
5873 | case BC_JLOOP: | 5870 | case BC_JLOOP: |
5874 | #if LJ_HASJIT | 5871 | #if LJ_HASJIT |
5875 | dasm_put(Dst, 4799); | 5872 | dasm_put(Dst, 4796); |
5876 | #endif | 5873 | #endif |
5877 | break; | 5874 | break; |
5878 | 5875 | ||
5879 | case BC_JMP: | 5876 | case BC_JMP: |
5880 | dasm_put(Dst, 4801, 32-1, -(BCBIAS_J*4 >> 16)); | 5877 | dasm_put(Dst, 4798, 32-1, -(BCBIAS_J*4 >> 16)); |
5881 | break; | 5878 | break; |
5882 | 5879 | ||
5883 | /* -- Function headers -------------------------------------------------- */ | 5880 | /* -- Function headers -------------------------------------------------- */ |
5884 | 5881 | ||
5885 | case BC_FUNCF: | 5882 | case BC_FUNCF: |
5886 | #if LJ_HASJIT | 5883 | #if LJ_HASJIT |
5887 | dasm_put(Dst, 4817); | 5884 | dasm_put(Dst, 4814); |
5888 | #endif | 5885 | #endif |
5889 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | 5886 | case BC_FUNCV: /* NYI: compiled vararg functions. */ |
5890 | break; | 5887 | break; |
@@ -5894,38 +5891,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5894 | break; | 5891 | break; |
5895 | #endif | 5892 | #endif |
5896 | case BC_IFUNCF: | 5893 | case BC_IFUNCF: |
5897 | dasm_put(Dst, 4819, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); | 5894 | dasm_put(Dst, 4816, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); |
5898 | if (op == BC_JFUNCF) { | 5895 | if (op == BC_JFUNCF) { |
5899 | dasm_put(Dst, 4837); | 5896 | dasm_put(Dst, 4834); |
5900 | } else { | 5897 | } else { |
5901 | dasm_put(Dst, 4839); | 5898 | dasm_put(Dst, 4836); |
5902 | } | 5899 | } |
5903 | dasm_put(Dst, 4848); | 5900 | dasm_put(Dst, 4845); |
5904 | break; | 5901 | break; |
5905 | 5902 | ||
5906 | case BC_JFUNCV: | 5903 | case BC_JFUNCV: |
5907 | #if !LJ_HASJIT | 5904 | #if !LJ_HASJIT |
5908 | break; | 5905 | break; |
5909 | #endif | 5906 | #endif |
5910 | dasm_put(Dst, 4854); | 5907 | dasm_put(Dst, 4851); |
5911 | break; /* NYI: compiled vararg functions. */ | 5908 | break; /* NYI: compiled vararg functions. */ |
5912 | 5909 | ||
5913 | case BC_IFUNCV: | 5910 | case BC_IFUNCV: |
5914 | dasm_put(Dst, 4856, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); | 5911 | dasm_put(Dst, 4853, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); |
5915 | break; | 5912 | break; |
5916 | 5913 | ||
5917 | case BC_FUNCC: | 5914 | case BC_FUNCC: |
5918 | case BC_FUNCCW: | 5915 | case BC_FUNCCW: |
5919 | if (op == BC_FUNCC) { | 5916 | if (op == BC_FUNCC) { |
5920 | dasm_put(Dst, 4906, Dt8(->f)); | 5917 | dasm_put(Dst, 4903, Dt8(->f)); |
5921 | } else { | 5918 | } else { |
5922 | dasm_put(Dst, 4909, DISPATCH_GL(wrapf)); | 5919 | dasm_put(Dst, 4906, DISPATCH_GL(wrapf)); |
5923 | } | 5920 | } |
5924 | dasm_put(Dst, 4912, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); | 5921 | dasm_put(Dst, 4909, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); |
5925 | if (op == BC_FUNCCW) { | 5922 | if (op == BC_FUNCCW) { |
5926 | dasm_put(Dst, 4925, Dt8(->f)); | 5923 | dasm_put(Dst, 4922, Dt8(->f)); |
5927 | } | 5924 | } |
5928 | dasm_put(Dst, 4928, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); | 5925 | dasm_put(Dst, 4925, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); |
5929 | break; | 5926 | break; |
5930 | 5927 | ||
5931 | /* ---------------------------------------------------------------------- */ | 5928 | /* ---------------------------------------------------------------------- */ |
@@ -5945,7 +5942,7 @@ static int build_backend(BuildCtx *ctx) | |||
5945 | 5942 | ||
5946 | build_subroutines(ctx); | 5943 | build_subroutines(ctx); |
5947 | 5944 | ||
5948 | dasm_put(Dst, 4949); | 5945 | dasm_put(Dst, 4946); |
5949 | for (op = 0; op < BC__MAX; op++) | 5946 | for (op = 0; op < BC__MAX; op++) |
5950 | build_ins(ctx, (BCOp)op, op); | 5947 | build_ins(ctx, (BCOp)op, op); |
5951 | 5948 | ||