aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-10 17:03:36 +0200
committerMike Pall <mike>2011-04-10 17:04:10 +0200
commitf69524f7f1cf7a78ce81790d4058c4350a136eb4 (patch)
tree778c2ab4ff74c5478da6c0b98dd3b66bd92cd348 /src
parent54e986a51db56b34cae7f50a86d6d8098a7e20f0 (diff)
downloadluajit-f69524f7f1cf7a78ce81790d4058c4350a136eb4.tar.gz
luajit-f69524f7f1cf7a78ce81790d4058c4350a136eb4.tar.bz2
luajit-f69524f7f1cf7a78ce81790d4058c4350a136eb4.zip
PPC: Misc. fixes for interpreter.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_ppc.dasc11
-rw-r--r--src/buildvm_ppcspe.h431
2 files changed, 220 insertions, 222 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc
index 7b5919ba..55270280 100644
--- a/src/buildvm_ppc.dasc
+++ b/src/buildvm_ppc.dasc
@@ -578,10 +578,9 @@ static void build_subroutines(BuildCtx *ctx)
578 |->cont_dispatch: 578 |->cont_dispatch:
579 | // BASE = meta base, RA = resultptr, RD = (nresults+1)*8 579 | // BASE = meta base, RA = resultptr, RD = (nresults+1)*8
580 | lwz TMP0, -12(BASE) // Continuation. 580 | lwz TMP0, -12(BASE) // Continuation.
581 | rlwinm TMP1, PC, 0, 0, 28
582 | mr RB, BASE 581 | mr RB, BASE
583 | sub BASE, BASE, TMP1 // Restore caller BASE. 582 | mr BASE, TMP2 // Restore caller BASE.
584 | lwz LFUNC:TMP1, FRAME_FUNC(BASE) 583 | lwz LFUNC:TMP1, FRAME_FUNC(TMP2)
585 | subi TMP2, RD, 8 584 | subi TMP2, RD, 8
586 | lwz PC, -16(RB) // Restore PC from [cont|PC]. 585 | lwz PC, -16(RB) // Restore PC from [cont|PC].
587 | lwz TMP1, LFUNC:TMP1->pc 586 | lwz TMP1, LFUNC:TMP1->pc
@@ -2514,13 +2513,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
2514 | evstdd TMP1, 0(CARG2) 2513 | evstdd TMP1, 0(CARG2)
2515 | cmplwi cr1, TMP0, 0 2514 | cmplwi cr1, TMP0, 0
2516 | cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq 2515 | cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq
2517 | subi TMP2, TMP2, LJ_TISNUM 2516 | subi TMP2, TMP2, (LJ_TISNUM+1)
2518 | bne >2 // Upvalue is closed and black? 2517 | bne >2 // Upvalue is closed and black?
2519 |1: 2518 |1:
2520 | ins_next 2519 | ins_next
2521 | 2520 |
2522 |2: // Check if new value is collectable. 2521 |2: // Check if new value is collectable.
2523 | cmplwi TMP2, LJ_TISGCV - LJ_TISNUM 2522 | cmplwi TMP2, LJ_TISGCV - (LJ_TISNUM+1)
2524 | bge <1 // tvisgcv(v) 2523 | bge <1 // tvisgcv(v)
2525 | lbz TMP3, GCOBJ:TMP1->gch.marked 2524 | lbz TMP3, GCOBJ:TMP1->gch.marked
2526 | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(v) 2525 | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(v)
@@ -2554,7 +2553,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
2554 |2: // Check if string is white and ensure upvalue is closed. 2553 |2: // Check if string is white and ensure upvalue is closed.
2555 | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(str) 2554 | andi. TMP3, TMP3, LJ_GC_WHITES // iswhite(str)
2556 | cmplwi cr1, TMP2, 0 2555 | cmplwi cr1, TMP2, 0
2557 | crand 4*cr0+eq, 4*cr0+eq, 4*cr1+eq 2556 | cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq
2558 | la CARG1, GG_DISP2G(DISPATCH) 2557 | la CARG1, GG_DISP2G(DISPATCH)
2559 | // Crossed a write barrier. Move the barrier forward. 2558 | // Crossed a write barrier. Move the barrier forward.
2560 | beq <1 2559 | beq <1
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h
index 5afd2379..8d972c12 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
15static const unsigned int build_actionlist[4947] = { 15static const unsigned int build_actionlist[4946] = {
160x00010001, 160x00010001,
170x00060014, 170x00060014,
180x72000000, 180x72000000,
@@ -459,10 +459,9 @@ static const unsigned int build_actionlist[4947] = {
4590x00050019, 4590x00050019,
4600x00060015, 4600x00060015,
4610x800efff4, 4610x800efff4,
4620x56080038,
4630x7dca7378, 4620x7dca7378,
4640x7dc87050, 4630x7d2e4b78,
4650x810efffc, 4640x8109fffc,
4660x392cfff8, 4650x392cfff8,
4670x820afff0, 4660x820afff0,
4680x81080000, 4670x81080000,
@@ -3566,7 +3565,7 @@ static const unsigned int build_actionlist[4947] = {
35660x70c60000, 35650x70c60000,
35670x00090200, 35660x00090200,
35680x28890000, 35670x28890000,
35690x4c423202, 35680x4c423382,
35700x38710000, 35690x38710000,
35710x00098200, 35700x00098200,
35720x41820000, 35710x41820000,
@@ -5320,99 +5319,99 @@ static void build_subroutines(BuildCtx *ctx)
5320 dasm_put(Dst, 188, Dt1(->base), Dt1(->top), Dt7(->pc), Dt1(->glref), Dt1(->status), FRAME_CP, CFRAME_RESUME, GG_G2DISP, Dt1(->cframe), Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, Dt1(->status), FRAME_TYPE, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); 5319 dasm_put(Dst, 188, Dt1(->base), Dt1(->top), Dt7(->pc), Dt1(->glref), Dt1(->status), FRAME_CP, CFRAME_RESUME, GG_G2DISP, Dt1(->cframe), Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, Dt1(->status), FRAME_TYPE, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate));
5321 dasm_put(Dst, 279, FRAME_CP, FRAME_C, Dt1(->cframe), Dt1(->cframe), Dt1(->glref), GG_G2DISP, Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); 5320 dasm_put(Dst, 279, FRAME_CP, FRAME_C, Dt1(->cframe), Dt1(->cframe), Dt1(->glref), GG_G2DISP, Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate));
5322 dasm_put(Dst, 376, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe), Dt1(->glref), FRAME_CP, GG_G2DISP, Dt7(->pc), PC2PROTO(k), Dt1(->base), DISPATCH_GL(tmptv)); 5321 dasm_put(Dst, 376, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe), Dt1(->glref), FRAME_CP, GG_G2DISP, Dt7(->pc), PC2PROTO(k), Dt1(->base), DISPATCH_GL(tmptv));
5323 dasm_put(Dst, 481, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv)); 5322 dasm_put(Dst, 480, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv));
5324 dasm_put(Dst, 558, DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base), -(BCBIAS_J*4 >> 16)); 5323 dasm_put(Dst, 557, DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base), -(BCBIAS_J*4 >> 16));
5325 dasm_put(Dst, 638, LJ_TTRUE, LJ_TFALSE, Dt1(->base), Dt1(->base)); 5324 dasm_put(Dst, 637, LJ_TTRUE, LJ_TFALSE, Dt1(->base), Dt1(->base));
5326 dasm_put(Dst, 707, FRAME_CONT, Dt1(->base), Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base)); 5325 dasm_put(Dst, 706, FRAME_CONT, Dt1(->base), Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base));
5327#if LJ_HASJIT 5326#if LJ_HASJIT
5328 dasm_put(Dst, 777); 5327 dasm_put(Dst, 776);
5329#endif 5328#endif
5330 dasm_put(Dst, 779); 5329 dasm_put(Dst, 778);
5331#if LJ_HASJIT 5330#if LJ_HASJIT
5332 dasm_put(Dst, 781, BC_JFORI); 5331 dasm_put(Dst, 780, BC_JFORI);
5333#endif 5332#endif
5334 dasm_put(Dst, 784); 5333 dasm_put(Dst, 783);
5335#if LJ_HASJIT 5334#if LJ_HASJIT
5336 dasm_put(Dst, 786, BC_JFORI); 5335 dasm_put(Dst, 785, BC_JFORI);
5337#endif 5336#endif
5338 dasm_put(Dst, 789, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])); 5337 dasm_put(Dst, 788, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable]));
5339 dasm_put(Dst, 854, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), LJ_TUDATA, 31-2, 4*~LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); 5338 dasm_put(Dst, 853, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), LJ_TUDATA, 31-2, 4*~LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT]));
5340 dasm_put(Dst, 910, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 5339 dasm_put(Dst, 909, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
5341 dasm_put(Dst, 970, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8); 5340 dasm_put(Dst, 969, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8);
5342#ifdef LUAJIT_ENABLE_LUA52COMPAT 5341#ifdef LUAJIT_ENABLE_LUA52COMPAT
5343 dasm_put(Dst, 1043, Dt6(->metatable), Dt8(->upvalue[0])); 5342 dasm_put(Dst, 1042, Dt6(->metatable), Dt8(->upvalue[0]));
5344#else 5343#else
5345 dasm_put(Dst, 1052, Dt8(->upvalue[0])); 5344 dasm_put(Dst, 1051, Dt8(->upvalue[0]));
5346#endif 5345#endif
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); 5346 dasm_put(Dst, 1055, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8);
5348 dasm_put(Dst, 1120); 5347 dasm_put(Dst, 1119);
5349#ifdef LUAJIT_ENABLE_LUA52COMPAT 5348#ifdef LUAJIT_ENABLE_LUA52COMPAT
5350 dasm_put(Dst, 1133, Dt6(->metatable), Dt8(->upvalue[0])); 5349 dasm_put(Dst, 1132, Dt6(->metatable), Dt8(->upvalue[0]));
5351#else 5350#else
5352 dasm_put(Dst, 1142, Dt8(->upvalue[0])); 5351 dasm_put(Dst, 1141, Dt8(->upvalue[0]));
5353#endif 5352#endif
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)); 5353 dasm_put(Dst, 1145, (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));
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)); 5354 dasm_put(Dst, 1206, 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));
5356 dasm_put(Dst, 1270, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); 5355 dasm_put(Dst, 1269, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3);
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); 5356 dasm_put(Dst, 1329, 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);
5358 dasm_put(Dst, 1389, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); 5357 dasm_put(Dst, 1388, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe));
5359 dasm_put(Dst, 1446, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); 5358 dasm_put(Dst, 1445, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE);
5360 dasm_put(Dst, 1511); 5359 dasm_put(Dst, 1510);
5361 dasm_put(Dst, 1580); 5360 dasm_put(Dst, 1579);
5362 dasm_put(Dst, 1643); 5361 dasm_put(Dst, 1642);
5363 dasm_put(Dst, 1708); 5362 dasm_put(Dst, 1707);
5364 dasm_put(Dst, 1778, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); 5363 dasm_put(Dst, 1777, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8);
5365 dasm_put(Dst, 1850, Dt5(->len)); 5364 dasm_put(Dst, 1849, Dt5(->len));
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)); 5365 dasm_put(Dst, 1916, 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));
5367 dasm_put(Dst, 1977, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); 5366 dasm_put(Dst, 1976, Dt5(->len), sizeof(GCstr)-1, 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)); 5367 dasm_put(Dst, 2042, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
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)); 5368 dasm_put(Dst, 2101, 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));
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)); 5369 dasm_put(Dst, 2160, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf));
5371 dasm_put(Dst, 2228); 5370 dasm_put(Dst, 2227);
5372 dasm_put(Dst, 2299); 5371 dasm_put(Dst, 2298);
5373 dasm_put(Dst, 2387, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); 5372 dasm_put(Dst, 2386, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc));
5374 dasm_put(Dst, 2466, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 5373 dasm_put(Dst, 2465, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
5375#if LJ_HASJIT 5374#if LJ_HASJIT
5376 dasm_put(Dst, 2508); 5375 dasm_put(Dst, 2507);
5377#endif 5376#endif
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)); 5377 dasm_put(Dst, 2509, 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));
5379 dasm_put(Dst, 2557, GG_DISP2STATIC); 5378 dasm_put(Dst, 2556, GG_DISP2STATIC);
5380#if LJ_HASJIT 5379#if LJ_HASJIT
5381 dasm_put(Dst, 2575); 5380 dasm_put(Dst, 2574);
5382#endif 5381#endif
5383 dasm_put(Dst, 2577); 5382 dasm_put(Dst, 2576);
5384#if LJ_HASJIT 5383#if LJ_HASJIT
5385 dasm_put(Dst, 2580); 5384 dasm_put(Dst, 2579);
5386#endif 5385#endif
5387 dasm_put(Dst, 2583); 5386 dasm_put(Dst, 2582);
5388#if LJ_HASJIT 5387#if LJ_HASJIT
5389 dasm_put(Dst, 2585); 5388 dasm_put(Dst, 2584);
5390#endif 5389#endif
5391 dasm_put(Dst, 2588, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 5390 dasm_put(Dst, 2587, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
5392#if LJ_HASJIT 5391#if LJ_HASJIT
5393 dasm_put(Dst, 2610); 5392 dasm_put(Dst, 2609);
5394#endif 5393#endif
5395 dasm_put(Dst, 2612); 5394 dasm_put(Dst, 2611);
5396#if LJ_HASJIT 5395#if LJ_HASJIT
5397 dasm_put(Dst, 2614); 5396 dasm_put(Dst, 2613);
5398#endif 5397#endif
5399 dasm_put(Dst, 2616); 5398 dasm_put(Dst, 2615);
5400#if LJ_HASJIT 5399#if LJ_HASJIT
5401 dasm_put(Dst, 2693); 5400 dasm_put(Dst, 2692);
5402#else 5401#else
5403 dasm_put(Dst, 2716); 5402 dasm_put(Dst, 2715);
5404#endif 5403#endif
5405 dasm_put(Dst, 2719); 5404 dasm_put(Dst, 2718);
5406#if LJ_HASJIT 5405#if LJ_HASJIT
5407 dasm_put(Dst, 2721); 5406 dasm_put(Dst, 2720);
5408#endif 5407#endif
5409 dasm_put(Dst, 2723); 5408 dasm_put(Dst, 2722);
5410#if LJ_HASJIT 5409#if LJ_HASJIT
5411 dasm_put(Dst, 2725); 5410 dasm_put(Dst, 2724);
5412#endif 5411#endif
5413 dasm_put(Dst, 2727); 5412 dasm_put(Dst, 2726);
5414#if LJ_HASFFI 5413#if LJ_HASFFI
5415 dasm_put(Dst, 2790); 5414 dasm_put(Dst, 2789);
5416#endif 5415#endif
5417} 5416}
5418 5417
@@ -5420,7 +5419,7 @@ static void build_subroutines(BuildCtx *ctx)
5420static void build_ins(BuildCtx *ctx, BCOp op, int defop) 5419static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5421{ 5420{
5422 int vk = 0; 5421 int vk = 0;
5423 dasm_put(Dst, 2792, defop); 5422 dasm_put(Dst, 2791, defop);
5424 5423
5425 switch (op) { 5424 switch (op) {
5426 5425
@@ -5429,112 +5428,112 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5429 /* Remember: all ops branch for a true comparison, fall through otherwise. */ 5428 /* Remember: all ops branch for a true comparison, fall through otherwise. */
5430 5429
5431 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 5430 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
5432 dasm_put(Dst, 2794, -(BCBIAS_J*4 >> 16)); 5431 dasm_put(Dst, 2793, -(BCBIAS_J*4 >> 16));
5433 if (op == BC_ISLE || op == BC_ISGT) { 5432 if (op == BC_ISLE || op == BC_ISGT) {
5434 dasm_put(Dst, 2808); 5433 dasm_put(Dst, 2807);
5435 } 5434 }
5436 if (op == BC_ISLT || op == BC_ISLE) { 5435 if (op == BC_ISLT || op == BC_ISLE) {
5437 dasm_put(Dst, 2811); 5436 dasm_put(Dst, 2810);
5438 } else { 5437 } else {
5439 dasm_put(Dst, 2813); 5438 dasm_put(Dst, 2812);
5440 } 5439 }
5441 dasm_put(Dst, 2815); 5440 dasm_put(Dst, 2814);
5442 break; 5441 break;
5443 5442
5444 case BC_ISEQV: case BC_ISNEV: 5443 case BC_ISEQV: case BC_ISNEV:
5445 vk = op == BC_ISEQV; 5444 vk = op == BC_ISEQV;
5446 dasm_put(Dst, 2826, -(BCBIAS_J*4 >> 16)); 5445 dasm_put(Dst, 2825, -(BCBIAS_J*4 >> 16));
5447 if (vk) { 5446 if (vk) {
5448 dasm_put(Dst, 2840); 5447 dasm_put(Dst, 2839);
5449 } else { 5448 } else {
5450 dasm_put(Dst, 2842); 5449 dasm_put(Dst, 2841);
5451 } 5450 }
5452 dasm_put(Dst, 2844, ~LJ_TISPRI, ~LJ_TISTABUD); 5451 dasm_put(Dst, 2843, ~LJ_TISPRI, ~LJ_TISTABUD);
5453 if (vk) { 5452 if (vk) {
5454 dasm_put(Dst, 2866); 5453 dasm_put(Dst, 2865);
5455 } else { 5454 } else {
5456 dasm_put(Dst, 2868); 5455 dasm_put(Dst, 2867);
5457 } 5456 }
5458 dasm_put(Dst, 2870); 5457 dasm_put(Dst, 2869);
5459 if (vk) { 5458 if (vk) {
5460 dasm_put(Dst, 2872); 5459 dasm_put(Dst, 2871);
5461 } else { 5460 } else {
5462 dasm_put(Dst, 2874); 5461 dasm_put(Dst, 2873);
5463 } 5462 }
5464 dasm_put(Dst, 2876, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); 5463 dasm_put(Dst, 2875, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq);
5465 break; 5464 break;
5466 5465
5467 case BC_ISEQS: case BC_ISNES: 5466 case BC_ISEQS: case BC_ISNES:
5468 vk = op == BC_ISEQS; 5467 vk = op == BC_ISEQS;
5469 dasm_put(Dst, 2897, 32-1, -(BCBIAS_J*4 >> 16)); 5468 dasm_put(Dst, 2896, 32-1, -(BCBIAS_J*4 >> 16));
5470 if (vk) { 5469 if (vk) {
5471 dasm_put(Dst, 2911); 5470 dasm_put(Dst, 2910);
5472 } else { 5471 } else {
5473 dasm_put(Dst, 2913); 5472 dasm_put(Dst, 2912);
5474 } 5473 }
5475 dasm_put(Dst, 2915); 5474 dasm_put(Dst, 2914);
5476 break; 5475 break;
5477 5476
5478 case BC_ISEQN: case BC_ISNEN: 5477 case BC_ISEQN: case BC_ISNEN:
5479 vk = op == BC_ISEQN; 5478 vk = op == BC_ISEQN;
5480 dasm_put(Dst, 2926, -(BCBIAS_J*4 >> 16)); 5479 dasm_put(Dst, 2925, -(BCBIAS_J*4 >> 16));
5481 if (vk) { 5480 if (vk) {
5482 dasm_put(Dst, 2940); 5481 dasm_put(Dst, 2939);
5483 } else { 5482 } else {
5484 dasm_put(Dst, 2943); 5483 dasm_put(Dst, 2942);
5485 } 5484 }
5486 dasm_put(Dst, 2945); 5485 dasm_put(Dst, 2944);
5487 if (!vk) { 5486 if (!vk) {
5488 dasm_put(Dst, 2957); 5487 dasm_put(Dst, 2956);
5489 } 5488 }
5490 break; 5489 break;
5491 5490
5492 case BC_ISEQP: case BC_ISNEP: 5491 case BC_ISEQP: case BC_ISNEP:
5493 vk = op == BC_ISEQP; 5492 vk = op == BC_ISEQP;
5494 dasm_put(Dst, 2963, 32-3, -(BCBIAS_J*4 >> 16)); 5493 dasm_put(Dst, 2962, 32-3, -(BCBIAS_J*4 >> 16));
5495 if (vk) { 5494 if (vk) {
5496 dasm_put(Dst, 2975); 5495 dasm_put(Dst, 2974);
5497 } else { 5496 } else {
5498 dasm_put(Dst, 2977); 5497 dasm_put(Dst, 2976);
5499 } 5498 }
5500 dasm_put(Dst, 2979); 5499 dasm_put(Dst, 2978);
5501 break; 5500 break;
5502 5501
5503 /* -- Unary test and copy ops ------------------------------------------- */ 5502 /* -- Unary test and copy ops ------------------------------------------- */
5504 5503
5505 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 5504 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
5506 dasm_put(Dst, 2990); 5505 dasm_put(Dst, 2989);
5507 if (op == BC_IST || op == BC_ISF) { 5506 if (op == BC_IST || op == BC_ISF) {
5508 dasm_put(Dst, 2996, -(BCBIAS_J*4 >> 16)); 5507 dasm_put(Dst, 2995, -(BCBIAS_J*4 >> 16));
5509 if (op == BC_IST) { 5508 if (op == BC_IST) {
5510 dasm_put(Dst, 3001); 5509 dasm_put(Dst, 3000);
5511 } else { 5510 } else {
5512 dasm_put(Dst, 3003); 5511 dasm_put(Dst, 3002);
5513 } 5512 }
5514 } else { 5513 } else {
5515 if (op == BC_ISTC) { 5514 if (op == BC_ISTC) {
5516 dasm_put(Dst, 3005); 5515 dasm_put(Dst, 3004);
5517 } else { 5516 } else {
5518 dasm_put(Dst, 3008); 5517 dasm_put(Dst, 3007);
5519 } 5518 }
5520 dasm_put(Dst, 3011, -(BCBIAS_J*4 >> 16)); 5519 dasm_put(Dst, 3010, -(BCBIAS_J*4 >> 16));
5521 } 5520 }
5522 dasm_put(Dst, 3018); 5521 dasm_put(Dst, 3017);
5523 break; 5522 break;
5524 5523
5525 /* -- Unary ops --------------------------------------------------------- */ 5524 /* -- Unary ops --------------------------------------------------------- */
5526 5525
5527 case BC_MOV: 5526 case BC_MOV:
5528 dasm_put(Dst, 3029); 5527 dasm_put(Dst, 3028);
5529 break; 5528 break;
5530 case BC_NOT: 5529 case BC_NOT:
5531 dasm_put(Dst, 3042, LJ_TTRUE); 5530 dasm_put(Dst, 3041, LJ_TTRUE);
5532 break; 5531 break;
5533 case BC_UNM: 5532 case BC_UNM:
5534 dasm_put(Dst, 3058); 5533 dasm_put(Dst, 3057);
5535 break; 5534 break;
5536 case BC_LEN: 5535 case BC_LEN:
5537 dasm_put(Dst, 3075, Dt5(->len)); 5536 dasm_put(Dst, 3074, Dt5(->len));
5538 break; 5537 break;
5539 5538
5540 /* -- Binary ops -------------------------------------------------------- */ 5539 /* -- Binary ops -------------------------------------------------------- */
@@ -5544,262 +5543,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5544 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5543 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5545 switch (vk) { 5544 switch (vk) {
5546 case 0: 5545 case 0:
5547 dasm_put(Dst, 3103); 5546 dasm_put(Dst, 3102);
5548 break; 5547 break;
5549 case 1: 5548 case 1:
5550 dasm_put(Dst, 3109); 5549 dasm_put(Dst, 3108);
5551 break; 5550 break;
5552 default: 5551 default:
5553 dasm_put(Dst, 3115); 5552 dasm_put(Dst, 3114);
5554 break; 5553 break;
5555 } 5554 }
5556 dasm_put(Dst, 3122); 5555 dasm_put(Dst, 3121);
5557 break; 5556 break;
5558 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 5557 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
5559 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5558 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5560 switch (vk) { 5559 switch (vk) {
5561 case 0: 5560 case 0:
5562 dasm_put(Dst, 3135); 5561 dasm_put(Dst, 3134);
5563 break; 5562 break;
5564 case 1: 5563 case 1:
5565 dasm_put(Dst, 3141); 5564 dasm_put(Dst, 3140);
5566 break; 5565 break;
5567 default: 5566 default:
5568 dasm_put(Dst, 3147); 5567 dasm_put(Dst, 3146);
5569 break; 5568 break;
5570 } 5569 }
5571 dasm_put(Dst, 3154); 5570 dasm_put(Dst, 3153);
5572 break; 5571 break;
5573 case BC_MULVN: case BC_MULNV: case BC_MULVV: 5572 case BC_MULVN: case BC_MULNV: case BC_MULVV:
5574 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5573 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5575 switch (vk) { 5574 switch (vk) {
5576 case 0: 5575 case 0:
5577 dasm_put(Dst, 3167); 5576 dasm_put(Dst, 3166);
5578 break; 5577 break;
5579 case 1: 5578 case 1:
5580 dasm_put(Dst, 3173); 5579 dasm_put(Dst, 3172);
5581 break; 5580 break;
5582 default: 5581 default:
5583 dasm_put(Dst, 3179); 5582 dasm_put(Dst, 3178);
5584 break; 5583 break;
5585 } 5584 }
5586 dasm_put(Dst, 3186); 5585 dasm_put(Dst, 3185);
5587 break; 5586 break;
5588 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 5587 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
5589 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5588 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5590 switch (vk) { 5589 switch (vk) {
5591 case 0: 5590 case 0:
5592 dasm_put(Dst, 3199); 5591 dasm_put(Dst, 3198);
5593 break; 5592 break;
5594 case 1: 5593 case 1:
5595 dasm_put(Dst, 3205); 5594 dasm_put(Dst, 3204);
5596 break; 5595 break;
5597 default: 5596 default:
5598 dasm_put(Dst, 3211); 5597 dasm_put(Dst, 3210);
5599 break; 5598 break;
5600 } 5599 }
5601 dasm_put(Dst, 3218); 5600 dasm_put(Dst, 3217);
5602 break; 5601 break;
5603 case BC_MODVN: 5602 case BC_MODVN:
5604 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5603 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5605 switch (vk) { 5604 switch (vk) {
5606 case 0: 5605 case 0:
5607 dasm_put(Dst, 3231); 5606 dasm_put(Dst, 3230);
5608 break; 5607 break;
5609 case 1: 5608 case 1:
5610 dasm_put(Dst, 3237); 5609 dasm_put(Dst, 3236);
5611 break; 5610 break;
5612 default: 5611 default:
5613 dasm_put(Dst, 3243); 5612 dasm_put(Dst, 3242);
5614 break; 5613 break;
5615 } 5614 }
5616 dasm_put(Dst, 3250); 5615 dasm_put(Dst, 3249);
5617 break; 5616 break;
5618 case BC_MODNV: case BC_MODVV: 5617 case BC_MODNV: case BC_MODVV:
5619 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5618 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5620 switch (vk) { 5619 switch (vk) {
5621 case 0: 5620 case 0:
5622 dasm_put(Dst, 3268); 5621 dasm_put(Dst, 3267);
5623 break; 5622 break;
5624 case 1: 5623 case 1:
5625 dasm_put(Dst, 3274); 5624 dasm_put(Dst, 3273);
5626 break; 5625 break;
5627 default: 5626 default:
5628 dasm_put(Dst, 3280); 5627 dasm_put(Dst, 3279);
5629 break; 5628 break;
5630 } 5629 }
5631 dasm_put(Dst, 3287); 5630 dasm_put(Dst, 3286);
5632 break; 5631 break;
5633 case BC_POW: 5632 case BC_POW:
5634 dasm_put(Dst, 3290); 5633 dasm_put(Dst, 3289);
5635 break; 5634 break;
5636 5635
5637 case BC_CAT: 5636 case BC_CAT:
5638 dasm_put(Dst, 3312, Dt1(->base), 32-3, Dt1(->base)); 5637 dasm_put(Dst, 3311, Dt1(->base), 32-3, Dt1(->base));
5639 break; 5638 break;
5640 5639
5641 /* -- Constant ops ------------------------------------------------------ */ 5640 /* -- Constant ops ------------------------------------------------------ */
5642 5641
5643 case BC_KSTR: 5642 case BC_KSTR:
5644 dasm_put(Dst, 3342, 32-1); 5643 dasm_put(Dst, 3341, 32-1);
5645 break; 5644 break;
5646 case BC_KCDATA: 5645 case BC_KCDATA:
5647#if LJ_HASFFI 5646#if LJ_HASFFI
5648 dasm_put(Dst, 3359, 32-1, LJ_TCDATA); 5647 dasm_put(Dst, 3358, 32-1, LJ_TCDATA);
5649#endif 5648#endif
5650 break; 5649 break;
5651 case BC_KSHORT: 5650 case BC_KSHORT:
5652 dasm_put(Dst, 3378, 32-3); 5651 dasm_put(Dst, 3377, 32-3);
5653 break; 5652 break;
5654 case BC_KNUM: 5653 case BC_KNUM:
5655 dasm_put(Dst, 3394); 5654 dasm_put(Dst, 3393);
5656 break; 5655 break;
5657 case BC_KPRI: 5656 case BC_KPRI:
5658 dasm_put(Dst, 3407, 32-3); 5657 dasm_put(Dst, 3406, 32-3);
5659 break; 5658 break;
5660 case BC_KNIL: 5659 case BC_KNIL:
5661 dasm_put(Dst, 3422); 5660 dasm_put(Dst, 3421);
5662 break; 5661 break;
5663 5662
5664 /* -- Upvalue and function ops ------------------------------------------ */ 5663 /* -- Upvalue and function ops ------------------------------------------ */
5665 5664
5666 case BC_UGET: 5665 case BC_UGET:
5667 dasm_put(Dst, 3441, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5666 dasm_put(Dst, 3440, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5668 break; 5667 break;
5669 case BC_USETV: 5668 case BC_USETV:
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); 5669 dasm_put(Dst, 3461, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
5671 break; 5670 break;
5672 case BC_USETS: 5671 case BC_USETS:
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); 5672 dasm_put(Dst, 3513, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G);
5674 break; 5673 break;
5675 case BC_USETN: 5674 case BC_USETN:
5676 dasm_put(Dst, 3563, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5675 dasm_put(Dst, 3562, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5677 break; 5676 break;
5678 case BC_USETP: 5677 case BC_USETP:
5679 dasm_put(Dst, 3584, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); 5678 dasm_put(Dst, 3583, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v));
5680 break; 5679 break;
5681 5680
5682 case BC_UCLO: 5681 case BC_UCLO:
5683 dasm_put(Dst, 3607, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); 5682 dasm_put(Dst, 3606, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
5684 break; 5683 break;
5685 5684
5686 case BC_FNEW: 5685 case BC_FNEW:
5687 dasm_put(Dst, 3637, 32-1, Dt1(->base), Dt1(->base)); 5686 dasm_put(Dst, 3636, 32-1, Dt1(->base), Dt1(->base));
5688 break; 5687 break;
5689 5688
5690 /* -- Table ops --------------------------------------------------------- */ 5689 /* -- Table ops --------------------------------------------------------- */
5691 5690
5692 case BC_TNEW: 5691 case BC_TNEW:
5693 case BC_TDUP: 5692 case BC_TDUP:
5694 dasm_put(Dst, 3663, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); 5693 dasm_put(Dst, 3662, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
5695 if (op == BC_TNEW) { 5694 if (op == BC_TNEW) {
5696 dasm_put(Dst, 3676); 5695 dasm_put(Dst, 3675);
5697 } else { 5696 } else {
5698 dasm_put(Dst, 3684, 32-1); 5697 dasm_put(Dst, 3683, 32-1);
5699 } 5698 }
5700 dasm_put(Dst, 3691, Dt1(->base)); 5699 dasm_put(Dst, 3690, Dt1(->base));
5701 break; 5700 break;
5702 5701
5703 case BC_GGET: 5702 case BC_GGET:
5704 case BC_GSET: 5703 case BC_GSET:
5705 dasm_put(Dst, 3714, 32-1, Dt7(->env)); 5704 dasm_put(Dst, 3713, 32-1, Dt7(->env));
5706 if (op == BC_GGET) { 5705 if (op == BC_GGET) {
5707 dasm_put(Dst, 3722); 5706 dasm_put(Dst, 3721);
5708 } else { 5707 } else {
5709 dasm_put(Dst, 3725); 5708 dasm_put(Dst, 3724);
5710 } 5709 }
5711 break; 5710 break;
5712 5711
5713 case BC_TGETV: 5712 case BC_TGETV:
5714 dasm_put(Dst, 3728, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5713 dasm_put(Dst, 3727, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5715 break; 5714 break;
5716 case BC_TGETS: 5715 case BC_TGETS:
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); 5716 dasm_put(Dst, 3785, 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);
5718 dasm_put(Dst, 3850); 5717 dasm_put(Dst, 3849);
5719 break; 5718 break;
5720 case BC_TGETB: 5719 case BC_TGETB:
5721 dasm_put(Dst, 3855, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5720 dasm_put(Dst, 3854, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5722 break; 5721 break;
5723 5722
5724 case BC_TSETV: 5723 case BC_TSETV:
5725 dasm_put(Dst, 3899, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 5724 dasm_put(Dst, 3898, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
5726 dasm_put(Dst, 3966, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 5725 dasm_put(Dst, 3965, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
5727 break; 5726 break;
5728 case BC_TSETS: 5727 case BC_TSETS:
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)); 5728 dasm_put(Dst, 3977, 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));
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)); 5729 dasm_put(Dst, 4038, 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));
5731 dasm_put(Dst, 4090, Dt6(->marked), Dt6(->gclist)); 5730 dasm_put(Dst, 4089, Dt6(->marked), Dt6(->gclist));
5732 break; 5731 break;
5733 case BC_TSETB: 5732 case BC_TSETB:
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)); 5733 dasm_put(Dst, 4096, 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));
5735 dasm_put(Dst, 4157, Dt6(->gclist)); 5734 dasm_put(Dst, 4156, Dt6(->gclist));
5736 break; 5735 break;
5737 5736
5738 case BC_TSETM: 5737 case BC_TSETM:
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)); 5738 dasm_put(Dst, 4161, 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));
5740 dasm_put(Dst, 4231); 5739 dasm_put(Dst, 4230);
5741 break; 5740 break;
5742 5741
5743 /* -- Calls and vararg handling ----------------------------------------- */ 5742 /* -- Calls and vararg handling ----------------------------------------- */
5744 5743
5745 case BC_CALLM: 5744 case BC_CALLM:
5746 dasm_put(Dst, 4234); 5745 dasm_put(Dst, 4233);
5747 break; 5746 break;
5748 case BC_CALL: 5747 case BC_CALL:
5749 dasm_put(Dst, 4236, Dt7(->pc)); 5748 dasm_put(Dst, 4235, Dt7(->pc));
5750 break; 5749 break;
5751 5750
5752 case BC_CALLMT: 5751 case BC_CALLMT:
5753 dasm_put(Dst, 4256); 5752 dasm_put(Dst, 4255);
5754 break; 5753 break;
5755 case BC_CALLT: 5754 case BC_CALLT:
5756 dasm_put(Dst, 4258, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5755 dasm_put(Dst, 4257, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5757 dasm_put(Dst, 4323, FRAME_TYPE); 5756 dasm_put(Dst, 4322, FRAME_TYPE);
5758 break; 5757 break;
5759 5758
5760 case BC_ITERC: 5759 case BC_ITERC:
5761 dasm_put(Dst, 4330, Dt7(->pc)); 5760 dasm_put(Dst, 4329, Dt7(->pc));
5762 break; 5761 break;
5763 5762
5764 case BC_ITERN: 5763 case BC_ITERN:
5765#if LJ_HASJIT 5764#if LJ_HASJIT
5766#endif 5765#endif
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)); 5766 dasm_put(Dst, 4355, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16));
5768 dasm_put(Dst, 4435); 5767 dasm_put(Dst, 4434);
5769 break; 5768 break;
5770 5769
5771 case BC_ISNEXT: 5770 case BC_ISNEXT:
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)); 5771 dasm_put(Dst, 4438, 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));
5773 break; 5772 break;
5774 5773
5775 case BC_VARG: 5774 case BC_VARG:
5776 dasm_put(Dst, 4490, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); 5775 dasm_put(Dst, 4489, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
5777 dasm_put(Dst, 4570); 5776 dasm_put(Dst, 4569);
5778 break; 5777 break;
5779 5778
5780 /* -- Returns ----------------------------------------------------------- */ 5779 /* -- Returns ----------------------------------------------------------- */
5781 5780
5782 case BC_RETM: 5781 case BC_RETM:
5783 dasm_put(Dst, 4576); 5782 dasm_put(Dst, 4575);
5784 break; 5783 break;
5785 5784
5786 case BC_RET: 5785 case BC_RET:
5787 dasm_put(Dst, 4578, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5786 dasm_put(Dst, 4577, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5788 break; 5787 break;
5789 5788
5790 case BC_RET0: case BC_RET1: 5789 case BC_RET0: case BC_RET1:
5791 dasm_put(Dst, 4648, FRAME_TYPE, FRAME_VARG); 5790 dasm_put(Dst, 4647, FRAME_TYPE, FRAME_VARG);
5792 if (op == BC_RET1) { 5791 if (op == BC_RET1) {
5793 dasm_put(Dst, 4661); 5792 dasm_put(Dst, 4660);
5794 } 5793 }
5795 dasm_put(Dst, 4664, Dt7(->pc), PC2PROTO(k)); 5794 dasm_put(Dst, 4663, Dt7(->pc), PC2PROTO(k));
5796 break; 5795 break;
5797 5796
5798 /* -- Loops and branches ------------------------------------------------ */ 5797 /* -- Loops and branches ------------------------------------------------ */
5799 5798
5800 case BC_FORL: 5799 case BC_FORL:
5801#if LJ_HASJIT 5800#if LJ_HASJIT
5802 dasm_put(Dst, 4692); 5801 dasm_put(Dst, 4691);
5803#endif 5802#endif
5804 break; 5803 break;
5805 5804
@@ -5811,35 +5810,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5811 case BC_FORI: 5810 case BC_FORI:
5812 case BC_IFORL: 5811 case BC_IFORL:
5813 vk = (op == BC_IFORL || op == BC_JFORL); 5812 vk = (op == BC_IFORL || op == BC_JFORL);
5814 dasm_put(Dst, 4694, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); 5813 dasm_put(Dst, 4693, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
5815 if (!vk) { 5814 if (!vk) {
5816 dasm_put(Dst, 4702); 5815 dasm_put(Dst, 4701);
5817 } 5816 }
5818 if (vk) { 5817 if (vk) {
5819 dasm_put(Dst, 4710, FORL_IDX*8); 5818 dasm_put(Dst, 4709, FORL_IDX*8);
5820 } 5819 }
5821 dasm_put(Dst, 4714, FORL_EXT*8); 5820 dasm_put(Dst, 4713, FORL_EXT*8);
5822 if (op != BC_JFORL) { 5821 if (op != BC_JFORL) {
5823 dasm_put(Dst, 4722, 32-1); 5822 dasm_put(Dst, 4721, 32-1);
5824 if (op == BC_JFORI) { 5823 if (op == BC_JFORI) {
5825 dasm_put(Dst, 4726, -(BCBIAS_J*4 >> 16)); 5824 dasm_put(Dst, 4725, -(BCBIAS_J*4 >> 16));
5826 } else { 5825 } else {
5827 dasm_put(Dst, 4729, -(BCBIAS_J*4 >> 16)); 5826 dasm_put(Dst, 4728, -(BCBIAS_J*4 >> 16));
5828 } 5827 }
5829 } 5828 }
5830 if (op == BC_FORI) { 5829 if (op == BC_FORI) {
5831 dasm_put(Dst, 4732); 5830 dasm_put(Dst, 4731);
5832 } else if (op == BC_IFORL) { 5831 } else if (op == BC_IFORL) {
5833 dasm_put(Dst, 4734); 5832 dasm_put(Dst, 4733);
5834 } else { 5833 } else {
5835 dasm_put(Dst, 4736, BC_JLOOP); 5834 dasm_put(Dst, 4735, BC_JLOOP);
5836 } 5835 }
5837 dasm_put(Dst, 4739); 5836 dasm_put(Dst, 4738);
5838 break; 5837 break;
5839 5838
5840 case BC_ITERL: 5839 case BC_ITERL:
5841#if LJ_HASJIT 5840#if LJ_HASJIT
5842 dasm_put(Dst, 4754); 5841 dasm_put(Dst, 4753);
5843#endif 5842#endif
5844 break; 5843 break;
5845 5844
@@ -5848,40 +5847,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5848 break; 5847 break;
5849#endif 5848#endif
5850 case BC_IITERL: 5849 case BC_IITERL:
5851 dasm_put(Dst, 4756); 5850 dasm_put(Dst, 4755);
5852 if (op == BC_JITERL) { 5851 if (op == BC_JITERL) {
5853 dasm_put(Dst, 4762); 5852 dasm_put(Dst, 4761);
5854 } else { 5853 } else {
5855 dasm_put(Dst, 4764, 32-1, -(BCBIAS_J*4 >> 16)); 5854 dasm_put(Dst, 4763, 32-1, -(BCBIAS_J*4 >> 16));
5856 } 5855 }
5857 dasm_put(Dst, 4771); 5856 dasm_put(Dst, 4770);
5858 break; 5857 break;
5859 5858
5860 case BC_LOOP: 5859 case BC_LOOP:
5861#if LJ_HASJIT 5860#if LJ_HASJIT
5862 dasm_put(Dst, 4783); 5861 dasm_put(Dst, 4782);
5863#endif 5862#endif
5864 break; 5863 break;
5865 5864
5866 case BC_ILOOP: 5865 case BC_ILOOP:
5867 dasm_put(Dst, 4785); 5866 dasm_put(Dst, 4784);
5868 break; 5867 break;
5869 5868
5870 case BC_JLOOP: 5869 case BC_JLOOP:
5871#if LJ_HASJIT 5870#if LJ_HASJIT
5872 dasm_put(Dst, 4796); 5871 dasm_put(Dst, 4795);
5873#endif 5872#endif
5874 break; 5873 break;
5875 5874
5876 case BC_JMP: 5875 case BC_JMP:
5877 dasm_put(Dst, 4798, 32-1, -(BCBIAS_J*4 >> 16)); 5876 dasm_put(Dst, 4797, 32-1, -(BCBIAS_J*4 >> 16));
5878 break; 5877 break;
5879 5878
5880 /* -- Function headers -------------------------------------------------- */ 5879 /* -- Function headers -------------------------------------------------- */
5881 5880
5882 case BC_FUNCF: 5881 case BC_FUNCF:
5883#if LJ_HASJIT 5882#if LJ_HASJIT
5884 dasm_put(Dst, 4814); 5883 dasm_put(Dst, 4813);
5885#endif 5884#endif
5886 case BC_FUNCV: /* NYI: compiled vararg functions. */ 5885 case BC_FUNCV: /* NYI: compiled vararg functions. */
5887 break; 5886 break;
@@ -5891,38 +5890,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5891 break; 5890 break;
5892#endif 5891#endif
5893 case BC_IFUNCF: 5892 case BC_IFUNCF:
5894 dasm_put(Dst, 4816, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); 5893 dasm_put(Dst, 4815, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
5895 if (op == BC_JFUNCF) { 5894 if (op == BC_JFUNCF) {
5896 dasm_put(Dst, 4834); 5895 dasm_put(Dst, 4833);
5897 } else { 5896 } else {
5898 dasm_put(Dst, 4836); 5897 dasm_put(Dst, 4835);
5899 } 5898 }
5900 dasm_put(Dst, 4845); 5899 dasm_put(Dst, 4844);
5901 break; 5900 break;
5902 5901
5903 case BC_JFUNCV: 5902 case BC_JFUNCV:
5904#if !LJ_HASJIT 5903#if !LJ_HASJIT
5905 break; 5904 break;
5906#endif 5905#endif
5907 dasm_put(Dst, 4851); 5906 dasm_put(Dst, 4850);
5908 break; /* NYI: compiled vararg functions. */ 5907 break; /* NYI: compiled vararg functions. */
5909 5908
5910 case BC_IFUNCV: 5909 case BC_IFUNCV:
5911 dasm_put(Dst, 4853, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); 5910 dasm_put(Dst, 4852, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams));
5912 break; 5911 break;
5913 5912
5914 case BC_FUNCC: 5913 case BC_FUNCC:
5915 case BC_FUNCCW: 5914 case BC_FUNCCW:
5916 if (op == BC_FUNCC) { 5915 if (op == BC_FUNCC) {
5917 dasm_put(Dst, 4903, Dt8(->f)); 5916 dasm_put(Dst, 4902, Dt8(->f));
5918 } else { 5917 } else {
5919 dasm_put(Dst, 4906, DISPATCH_GL(wrapf)); 5918 dasm_put(Dst, 4905, DISPATCH_GL(wrapf));
5920 } 5919 }
5921 dasm_put(Dst, 4909, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); 5920 dasm_put(Dst, 4908, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
5922 if (op == BC_FUNCCW) { 5921 if (op == BC_FUNCCW) {
5923 dasm_put(Dst, 4922, Dt8(->f)); 5922 dasm_put(Dst, 4921, Dt8(->f));
5924 } 5923 }
5925 dasm_put(Dst, 4925, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); 5924 dasm_put(Dst, 4924, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
5926 break; 5925 break;
5927 5926
5928 /* ---------------------------------------------------------------------- */ 5927 /* ---------------------------------------------------------------------- */
@@ -5942,7 +5941,7 @@ static int build_backend(BuildCtx *ctx)
5942 5941
5943 build_subroutines(ctx); 5942 build_subroutines(ctx);
5944 5943
5945 dasm_put(Dst, 4946); 5944 dasm_put(Dst, 4945);
5946 for (op = 0; op < BC__MAX; op++) 5945 for (op = 0; op < BC__MAX; op++)
5947 build_ins(ctx, (BCOp)op, op); 5946 build_ins(ctx, (BCOp)op, op);
5948 5947