aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-08-10 22:09:14 +0200
committerMike Pall <mike>2011-08-10 22:33:52 +0200
commite8fa76feace720c8348f08fd0e0c9f0656277987 (patch)
tree67b7cb0b9ef18d217dbcc0204a6808f05af39458 /src
parentd84207b8b6b906f9ec6eb1861a9319fb574dd1f8 (diff)
downloadluajit-e8fa76feace720c8348f08fd0e0c9f0656277987.tar.gz
luajit-e8fa76feace720c8348f08fd0e0c9f0656277987.tar.bz2
luajit-e8fa76feace720c8348f08fd0e0c9f0656277987.zip
PPCSPE: Save/restore cr2, cr3 and cr4 when entering/leaving VM.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_ppcspe.dasc58
-rw-r--r--src/buildvm_ppcspe.h664
-rw-r--r--src/lj_ccall.c2
-rw-r--r--src/lj_ccall.h2
-rw-r--r--src/lj_frame.h2
5 files changed, 372 insertions, 356 deletions
diff --git a/src/buildvm_ppcspe.dasc b/src/buildvm_ppcspe.dasc
index 5d85961b..92914f98 100644
--- a/src/buildvm_ppcspe.dasc
+++ b/src/buildvm_ppcspe.dasc
@@ -61,27 +61,29 @@
61|.define CRET2, r4 61|.define CRET2, r4
62| 62|
63|// Stack layout while in interpreter. Must match with lj_frame.h. 63|// Stack layout while in interpreter. Must match with lj_frame.h.
64|.define SAVE_LR, 180(sp) 64|.define SAVE_LR, 188(sp)
65|.define CFRAME_SPACE, 176 // Delta for sp. 65|.define CFRAME_SPACE, 184 // Delta for sp.
66|// Back chain for sp: 176(sp) <-- sp entering interpreter 66|// Back chain for sp: 184(sp) <-- sp entering interpreter
67|.define SAVE_r31, 168(sp) // 64 bit register saves. 67|.define SAVE_r31, 176(sp) // 64 bit register saves.
68|.define SAVE_r30, 160(sp) 68|.define SAVE_r30, 168(sp)
69|.define SAVE_r29, 152(sp) 69|.define SAVE_r29, 160(sp)
70|.define SAVE_r28, 144(sp) 70|.define SAVE_r28, 152(sp)
71|.define SAVE_r27, 136(sp) 71|.define SAVE_r27, 144(sp)
72|.define SAVE_r26, 128(sp) 72|.define SAVE_r26, 136(sp)
73|.define SAVE_r25, 120(sp) 73|.define SAVE_r25, 128(sp)
74|.define SAVE_r24, 112(sp) 74|.define SAVE_r24, 120(sp)
75|.define SAVE_r23, 104(sp) 75|.define SAVE_r23, 112(sp)
76|.define SAVE_r22, 96(sp) 76|.define SAVE_r22, 104(sp)
77|.define SAVE_r21, 88(sp) 77|.define SAVE_r21, 96(sp)
78|.define SAVE_r20, 80(sp) 78|.define SAVE_r20, 88(sp)
79|.define SAVE_r19, 72(sp) 79|.define SAVE_r19, 80(sp)
80|.define SAVE_r18, 64(sp) 80|.define SAVE_r18, 72(sp)
81|.define SAVE_r17, 56(sp) 81|.define SAVE_r17, 64(sp)
82|.define SAVE_r16, 48(sp) 82|.define SAVE_r16, 56(sp)
83|.define SAVE_r15, 40(sp) 83|.define SAVE_r15, 48(sp)
84|.define SAVE_r14, 32(sp) 84|.define SAVE_r14, 40(sp)
85|.define SAVE_CR, 36(sp)
86|.define UNUSED1, 32(sp)
85|.define SAVE_ERRF, 28(sp) // 32 bit C frame info. 87|.define SAVE_ERRF, 28(sp) // 32 bit C frame info.
86|.define SAVE_NRES, 24(sp) 88|.define SAVE_NRES, 24(sp)
87|.define SAVE_CFRAME, 20(sp) 89|.define SAVE_CFRAME, 20(sp)
@@ -97,16 +99,16 @@
97|.macro saveregs 99|.macro saveregs
98| stwu sp, -CFRAME_SPACE(sp) 100| stwu sp, -CFRAME_SPACE(sp)
99| save_ r14; save_ r15; save_ r16; save_ r17; save_ r18; save_ r19 101| save_ r14; save_ r15; save_ r16; save_ r17; save_ r18; save_ r19
100| mflr r0 102| mflr r0; mfcr r12
101| save_ r20; save_ r21; save_ r22; save_ r23; save_ r24; save_ r25 103| save_ r20; save_ r21; save_ r22; save_ r23; save_ r24; save_ r25
102| stw r0, SAVE_LR 104| stw r0, SAVE_LR; stw r12, SAVE_CR
103| save_ r26; save_ r27; save_ r28; save_ r29; save_ r30; save_ r31 105| save_ r26; save_ r27; save_ r28; save_ r29; save_ r30; save_ r31
104|.endmacro 106|.endmacro
105| 107|
106|.macro restoreregs 108|.macro restoreregs
107| lwz r0, SAVE_LR 109| lwz r0, SAVE_LR; lwz r12, SAVE_CR
108| rest_ r14; rest_ r15; rest_ r16; rest_ r17; rest_ r18; rest_ r19 110| rest_ r14; rest_ r15; rest_ r16; rest_ r17; rest_ r18; rest_ r19
109| mtlr r0 111| mtlr r0; mtcrf 0x38, r12
110| rest_ r20; rest_ r21; rest_ r22; rest_ r23; rest_ r24; rest_ r25 112| rest_ r20; rest_ r21; rest_ r22; rest_ r23; rest_ r24; rest_ r25
111| rest_ r26; rest_ r27; rest_ r28; rest_ r29; rest_ r30; rest_ r31 113| rest_ r26; rest_ r27; rest_ r28; rest_ r29; rest_ r30; rest_ r31
112| addi sp, sp, CFRAME_SPACE 114| addi sp, sp, CFRAME_SPACE
@@ -3656,7 +3658,8 @@ static void emit_asm_debug(BuildCtx *ctx)
3656 "\t.long .Lbegin\n" 3658 "\t.long .Lbegin\n"
3657 "\t.long %d\n" 3659 "\t.long %d\n"
3658 "\t.byte 0xe\n\t.uleb128 %d\n" 3660 "\t.byte 0xe\n\t.uleb128 %d\n"
3659 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", 3661 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
3662 "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
3660 (int)ctx->codesz, CFRAME_SIZE); 3663 (int)ctx->codesz, CFRAME_SIZE);
3661 for (i = 14; i <= 31; i++) 3664 for (i = 14; i <= 31; i++)
3662 fprintf(ctx->fp, 3665 fprintf(ctx->fp,
@@ -3693,7 +3696,8 @@ static void emit_asm_debug(BuildCtx *ctx)
3693 "\t.long %d\n" 3696 "\t.long %d\n"
3694 "\t.uleb128 0\n" /* augmentation length */ 3697 "\t.uleb128 0\n" /* augmentation length */
3695 "\t.byte 0xe\n\t.uleb128 %d\n" 3698 "\t.byte 0xe\n\t.uleb128 %d\n"
3696 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", 3699 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
3700 "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
3697 (int)ctx->codesz, CFRAME_SIZE); 3701 (int)ctx->codesz, CFRAME_SIZE);
3698 for (i = 14; i <= 31; i++) 3702 for (i = 14; i <= 31; i++)
3699 fprintf(ctx->fp, 3703 fprintf(ctx->fp,
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h
index cf3c226e..a3eedd6e 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[4993] = { 15static const unsigned int build_actionlist[5003] = {
160x00010001, 160x00010001,
170x00060014, 170x00060014,
180x72000000, 180x72000000,
@@ -73,27 +73,29 @@ static const unsigned int build_actionlist[4993] = {
730x90120000, 730x90120000,
740x00098200, 740x00098200,
750x0006001a, 750x0006001a,
760x800100b4, 760x800100bc,
770x11c12301, 770x81810024,
780x11e12b01, 780x11c12b01,
790x12013301, 790x11e13301,
800x12213b01, 800x12013b01,
810x12414301, 810x12214301,
820x12614b01, 820x12414b01,
830x12615301,
830x7c0803a6, 840x7c0803a6,
840x12815301, 850x7d838120,
850x12a15b01, 860x12815b01,
860x12c16301, 870x12a16301,
870x12e16b01, 880x12c16b01,
880x13017301, 890x12e17301,
890x13217b01, 900x13017b01,
900x13418301, 910x13218301,
910x13618b01, 920x13418b01,
920x13819301, 930x13619301,
930x13a19b01, 940x13819b01,
940x13c1a301, 950x13a1a301,
950x13e1ab01, 960x13c1ab01,
960x382100b0, 970x13e1b301,
980x382100b8,
970x4e800020, 990x4e800020,
980x00060010, 1000x00060010,
990x40810000, 1010x40810000,
@@ -218,27 +220,29 @@ static const unsigned int build_actionlist[4993] = {
2180x7c0903a6, 2200x7c0903a6,
2190x4e800420, 2210x4e800420,
2200x00060021, 2220x00060021,
2210x9421ff50, 2230x9421ff48,
2220x11c12321, 2240x11c12b21,
2230x11e12b21, 2250x11e13321,
2240x12013321, 2260x12013b21,
2250x12213b21, 2270x12214321,
2260x12414321, 2280x12414b21,
2270x12614b21, 2290x12615321,
2280x7c0802a6, 2300x7c0802a6,
2290x12815321, 2310x7d800026,
2300x12a15b21, 2320x12815b21,
2310x12c16321, 2330x12a16321,
2320x12e16b21, 2340x12c16b21,
2330x13017321, 2350x12e17321,
2340x13217b21, 2360x13017b21,
2350x900100b4, 2370x13218321,
2360x13418321, 2380x900100bc,
2370x13618b21, 2390x91810024,
2380x13819321, 2400x13418b21,
2390x13a19b21, 2410x13619321,
2400x13c1a321, 2420x13819b21,
2410x13e1ab21, 2430x13a1a321,
2440x13c1ab21,
2450x13e1b321,
2420x7c721b78, 2460x7c721b78,
2430x82320000, 2470x82320000,
2440x00098200, 2480x00098200,
@@ -297,54 +301,58 @@ static const unsigned int build_actionlist[4993] = {
2970x48000000, 3010x48000000,
2980x00050018, 3020x00050018,
2990x00060022, 3030x00060022,
3000x9421ff50, 3040x9421ff48,
3010x11c12321, 3050x11c12b21,
3020x11e12b21, 3060x11e13321,
3030x12013321, 3070x12013b21,
3040x12213b21, 3080x12214321,
3050x12414321, 3090x12414b21,
3060x12614b21, 3100x12615321,
3070x7c0802a6, 3110x7c0802a6,
3080x12815321, 3120x7d800026,
3090x12a15b21, 3130x12815b21,
3100x12c16321, 3140x12a16321,
3110x12e16b21, 3150x12c16b21,
3120x13017321, 3160x12e17321,
3130x13217b21, 3170x13017b21,
3140x900100b4, 3180x13218321,
3150x13418321, 3190x900100bc,
3160x13618b21, 3200x91810024,
3170x13819321, 3210x13418b21,
3180x13a19b21, 3220x13619321,
3190x13c1a321, 3230x13819b21,
3200x13e1ab21, 3240x13a1a321,
3250x13c1ab21,
3260x13e1b321,
3210x3a000000, 3270x3a000000,
3220x00098200, 3280x00098200,
3230x90c1001c, 3290x90c1001c,
3240x48000000, 3300x48000000,
3250x00050001, 3310x00050001,
3260x00060023, 3320x00060023,
3270x9421ff50, 3330x9421ff48,
3280x11c12321, 3340x11c12b21,
3290x11e12b21, 3350x11e13321,
3300x12013321, 3360x12013b21,
3310x12213b21, 3370x12214321,
3320x12414321, 3380x12414b21,
3330x12614b21, 3390x12615321,
3340x7c0802a6, 3400x7c0802a6,
3350x12815321, 3410x7d800026,
3360x12a15b21, 3420x12815b21,
3370x12c16321, 3430x12a16321,
3380x12e16b21, 3440x12c16b21,
3390x13017321, 3450x12e17321,
3400x13217b21, 3460x13017b21,
3410x900100b4, 3470x13218321,
3420x13418321, 3480x900100bc,
3430x13618b21, 3490x91810024,
3440x13819321, 3500x13418b21,
3450x13a19b21, 3510x13619321,
3460x13c1a321, 3520x13819b21,
3470x13e1ab21, 3530x13a1a321,
3540x13c1ab21,
3550x13e1b321,
3480x3a000000, 3560x3a000000,
3490x00098200, 3570x00098200,
3500x0006000b, 3580x0006000b,
@@ -407,27 +415,29 @@ static const unsigned int build_actionlist[4993] = {
4070x7c0903a6, 4150x7c0903a6,
4080x4e800420, 4160x4e800420,
4090x00060027, 4170x00060027,
4100x9421ff50, 4180x9421ff48,
4110x11c12321, 4190x11c12b21,
4120x11e12b21, 4200x11e13321,
4130x12013321, 4210x12013b21,
4140x12213b21, 4220x12214321,
4150x12414321, 4230x12414b21,
4160x12614b21, 4240x12615321,
4170x7c0802a6, 4250x7c0802a6,
4180x12815321, 4260x7d800026,
4190x12a15b21, 4270x12815b21,
4200x12c16321, 4280x12a16321,
4210x12e16b21, 4290x12c16b21,
4220x13017321, 4300x12e17321,
4230x13217b21, 4310x13017b21,
4240x900100b4, 4320x13218321,
4250x13418321, 4330x900100bc,
4260x13618b21, 4340x91810024,
4270x13819321, 4350x13418b21,
4280x13a19b21, 4360x13619321,
4290x13c1a321, 4370x13819b21,
4300x13e1ab21, 4380x13a1a321,
4390x13c1ab21,
4400x13e1b321,
4310x7c721b78, 4410x7c721b78,
4320x80030000, 4420x80030000,
4330x00098200, 4430x00098200,
@@ -5368,113 +5378,113 @@ static void build_subroutines(BuildCtx *ctx)
5368 dasm_put(Dst, 0); 5378 dasm_put(Dst, 0);
5369 dasm_put(Dst, 1, FRAME_P, LJ_TTRUE, FRAME_TYPE, FRAME_C, ~LJ_VMST_C, Dt1(->base), DISPATCH_GL(vmstate), 31-3, Dt1(->top)); 5379 dasm_put(Dst, 1, FRAME_P, LJ_TTRUE, FRAME_TYPE, FRAME_C, ~LJ_VMST_C, Dt1(->base), DISPATCH_GL(vmstate), 31-3, Dt1(->top));
5370 dasm_put(Dst, 55, Dt1(->cframe), Dt1(->maxstack), Dt1(->top), 31-3, Dt1(->top), ~LJ_VMST_C, Dt1(->glref), Dt2(->vmstate)); 5380 dasm_put(Dst, 55, Dt1(->cframe), Dt1(->maxstack), Dt1(->top), 31-3, Dt1(->top), ~LJ_VMST_C, Dt1(->glref), Dt2(->vmstate));
5371 dasm_put(Dst, 133, LJ_TISNUM+1, LJ_TFUNC, LJ_TTAB, Dt1(->base), Dt1(->glref), LJ_TSTR, LJ_TFALSE, LJ_TNIL, ~LJ_VMST_INTERP, GG_G2DISP, DISPATCH_GL(vmstate), LUA_MINSTACK, Dt1(->base), Dt1(->top), 32-3); 5381 dasm_put(Dst, 135, LJ_TISNUM+1, LJ_TFUNC, LJ_TTAB, Dt1(->base), Dt1(->glref), LJ_TSTR, LJ_TFALSE, LJ_TNIL, ~LJ_VMST_INTERP, GG_G2DISP, DISPATCH_GL(vmstate), LUA_MINSTACK, Dt1(->base), Dt1(->top), 32-3);
5372 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)); 5382 dasm_put(Dst, 190, 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));
5373 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)); 5383 dasm_put(Dst, 283, 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));
5374 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)); 5384 dasm_put(Dst, 384, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe), Dt1(->glref), FRAME_CP, GG_G2DISP, Dt7(->pc), PC2PROTO(k), Dt1(->base));
5375 dasm_put(Dst, 481, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv)); 5385 dasm_put(Dst, 491, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv));
5376 dasm_put(Dst, 556, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base)); 5386 dasm_put(Dst, 566, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base));
5377 dasm_put(Dst, 637, -(BCBIAS_J*4 >> 16), LJ_TTRUE, LJ_TFALSE, Dt1(->base)); 5387 dasm_put(Dst, 647, -(BCBIAS_J*4 >> 16), LJ_TTRUE, LJ_TFALSE, Dt1(->base));
5378 dasm_put(Dst, 706, Dt1(->base), FRAME_CONT); 5388 dasm_put(Dst, 716, Dt1(->base), FRAME_CONT);
5379#ifdef LUAJIT_ENABLE_LUA52COMPAT 5389#ifdef LUAJIT_ENABLE_LUA52COMPAT
5380 dasm_put(Dst, 729); 5390 dasm_put(Dst, 739);
5381#endif 5391#endif
5382 dasm_put(Dst, 731, Dt1(->base)); 5392 dasm_put(Dst, 741, Dt1(->base));
5383#ifdef LUAJIT_ENABLE_LUA52COMPAT 5393#ifdef LUAJIT_ENABLE_LUA52COMPAT
5384 dasm_put(Dst, 739); 5394 dasm_put(Dst, 749);
5385#else 5395#else
5386 dasm_put(Dst, 746); 5396 dasm_put(Dst, 756);
5387#endif 5397#endif
5388 dasm_put(Dst, 749, Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base)); 5398 dasm_put(Dst, 759, Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base));
5389#if LJ_HASJIT 5399#if LJ_HASJIT
5390 dasm_put(Dst, 797); 5400 dasm_put(Dst, 807);
5391#endif 5401#endif
5392 dasm_put(Dst, 799); 5402 dasm_put(Dst, 809);
5393#if LJ_HASJIT 5403#if LJ_HASJIT
5394 dasm_put(Dst, 801, BC_JFORI); 5404 dasm_put(Dst, 811, BC_JFORI);
5395#endif 5405#endif
5396 dasm_put(Dst, 804); 5406 dasm_put(Dst, 814);
5397#if LJ_HASJIT 5407#if LJ_HASJIT
5398 dasm_put(Dst, 806, BC_JFORI); 5408 dasm_put(Dst, 816, BC_JFORI);
5399#endif 5409#endif
5400 dasm_put(Dst, 809, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])); 5410 dasm_put(Dst, 819, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable]));
5401 dasm_put(Dst, 874, 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])); 5411 dasm_put(Dst, 884, 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]));
5402 dasm_put(Dst, 930, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 5412 dasm_put(Dst, 940, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
5403 dasm_put(Dst, 990, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8); 5413 dasm_put(Dst, 1000, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8);
5404#ifdef LUAJIT_ENABLE_LUA52COMPAT 5414#ifdef LUAJIT_ENABLE_LUA52COMPAT
5405 dasm_put(Dst, 1063, Dt6(->metatable), Dt8(->upvalue[0])); 5415 dasm_put(Dst, 1073, Dt6(->metatable), Dt8(->upvalue[0]));
5406#else 5416#else
5407 dasm_put(Dst, 1072, Dt8(->upvalue[0])); 5417 dasm_put(Dst, 1082, Dt8(->upvalue[0]));
5408#endif 5418#endif
5409 dasm_put(Dst, 1076, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8); 5419 dasm_put(Dst, 1086, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8);
5410 dasm_put(Dst, 1140); 5420 dasm_put(Dst, 1150);
5411#ifdef LUAJIT_ENABLE_LUA52COMPAT 5421#ifdef LUAJIT_ENABLE_LUA52COMPAT
5412 dasm_put(Dst, 1153, Dt6(->metatable), Dt8(->upvalue[0])); 5422 dasm_put(Dst, 1163, Dt6(->metatable), Dt8(->upvalue[0]));
5413#else 5423#else
5414 dasm_put(Dst, 1162, Dt8(->upvalue[0])); 5424 dasm_put(Dst, 1172, Dt8(->upvalue[0]));
5415#endif 5425#endif
5416 dasm_put(Dst, 1166, (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)); 5426 dasm_put(Dst, 1176, (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));
5417 dasm_put(Dst, 1227, 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)); 5427 dasm_put(Dst, 1237, 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));
5418 dasm_put(Dst, 1290, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); 5428 dasm_put(Dst, 1300, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3);
5419 dasm_put(Dst, 1350, 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); 5429 dasm_put(Dst, 1360, 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);
5420 dasm_put(Dst, 1409, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); 5430 dasm_put(Dst, 1419, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe));
5421 dasm_put(Dst, 1466, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); 5431 dasm_put(Dst, 1476, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE);
5422 dasm_put(Dst, 1531); 5432 dasm_put(Dst, 1541);
5423 dasm_put(Dst, 1600); 5433 dasm_put(Dst, 1610);
5424 dasm_put(Dst, 1663); 5434 dasm_put(Dst, 1673);
5425 dasm_put(Dst, 1728); 5435 dasm_put(Dst, 1738);
5426 dasm_put(Dst, 1798, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); 5436 dasm_put(Dst, 1808, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8);
5427 dasm_put(Dst, 1870, Dt5(->len)); 5437 dasm_put(Dst, 1880, Dt5(->len));
5428 dasm_put(Dst, 1937, 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)); 5438 dasm_put(Dst, 1947, 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));
5429 dasm_put(Dst, 1997, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); 5439 dasm_put(Dst, 2007, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
5430 dasm_put(Dst, 2063, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); 5440 dasm_put(Dst, 2073, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold));
5431 dasm_put(Dst, 2122, 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)); 5441 dasm_put(Dst, 2132, 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));
5432 dasm_put(Dst, 2181, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); 5442 dasm_put(Dst, 2191, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf));
5433 dasm_put(Dst, 2248); 5443 dasm_put(Dst, 2258);
5434 dasm_put(Dst, 2319); 5444 dasm_put(Dst, 2329);
5435 dasm_put(Dst, 2407, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); 5445 dasm_put(Dst, 2417, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc));
5436 dasm_put(Dst, 2486, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 5446 dasm_put(Dst, 2496, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
5437#if LJ_HASJIT 5447#if LJ_HASJIT
5438 dasm_put(Dst, 2528); 5448 dasm_put(Dst, 2538);
5439#endif 5449#endif
5440 dasm_put(Dst, 2530, 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)); 5450 dasm_put(Dst, 2540, 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));
5441 dasm_put(Dst, 2577, GG_DISP2STATIC); 5451 dasm_put(Dst, 2587, GG_DISP2STATIC);
5442#if LJ_HASJIT 5452#if LJ_HASJIT
5443 dasm_put(Dst, 2595); 5453 dasm_put(Dst, 2605);
5444#endif 5454#endif
5445 dasm_put(Dst, 2597); 5455 dasm_put(Dst, 2607);
5446#if LJ_HASJIT 5456#if LJ_HASJIT
5447 dasm_put(Dst, 2600); 5457 dasm_put(Dst, 2610);
5448#endif 5458#endif
5449 dasm_put(Dst, 2603); 5459 dasm_put(Dst, 2613);
5450#if LJ_HASJIT 5460#if LJ_HASJIT
5451 dasm_put(Dst, 2605); 5461 dasm_put(Dst, 2615);
5452#endif 5462#endif
5453 dasm_put(Dst, 2608, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 5463 dasm_put(Dst, 2618, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
5454#if LJ_HASJIT 5464#if LJ_HASJIT
5455 dasm_put(Dst, 2630); 5465 dasm_put(Dst, 2640);
5456#endif 5466#endif
5457 dasm_put(Dst, 2632); 5467 dasm_put(Dst, 2642);
5458#if LJ_HASJIT 5468#if LJ_HASJIT
5459 dasm_put(Dst, 2634); 5469 dasm_put(Dst, 2644);
5460#endif 5470#endif
5461 dasm_put(Dst, 2636); 5471 dasm_put(Dst, 2646);
5462#if LJ_HASJIT 5472#if LJ_HASJIT
5463 dasm_put(Dst, 2720); 5473 dasm_put(Dst, 2730);
5464#else 5474#else
5465 dasm_put(Dst, 2743); 5475 dasm_put(Dst, 2753);
5466#endif 5476#endif
5467 dasm_put(Dst, 2746); 5477 dasm_put(Dst, 2756);
5468#if LJ_HASJIT 5478#if LJ_HASJIT
5469 dasm_put(Dst, 2748); 5479 dasm_put(Dst, 2758);
5470#endif 5480#endif
5471 dasm_put(Dst, 2750); 5481 dasm_put(Dst, 2760);
5472#if LJ_HASJIT 5482#if LJ_HASJIT
5473 dasm_put(Dst, 2752); 5483 dasm_put(Dst, 2762);
5474#endif 5484#endif
5475 dasm_put(Dst, 2754); 5485 dasm_put(Dst, 2764);
5476#if LJ_HASFFI 5486#if LJ_HASFFI
5477 dasm_put(Dst, 2817); 5487 dasm_put(Dst, 2827);
5478#endif 5488#endif
5479} 5489}
5480 5490
@@ -5482,7 +5492,7 @@ static void build_subroutines(BuildCtx *ctx)
5482static void build_ins(BuildCtx *ctx, BCOp op, int defop) 5492static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5483{ 5493{
5484 int vk = 0; 5494 int vk = 0;
5485 dasm_put(Dst, 2819, defop); 5495 dasm_put(Dst, 2829, defop);
5486 5496
5487 switch (op) { 5497 switch (op) {
5488 5498
@@ -5491,118 +5501,118 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5491 /* Remember: all ops branch for a true comparison, fall through otherwise. */ 5501 /* Remember: all ops branch for a true comparison, fall through otherwise. */
5492 5502
5493 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 5503 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
5494 dasm_put(Dst, 2821, -(BCBIAS_J*4 >> 16)); 5504 dasm_put(Dst, 2831, -(BCBIAS_J*4 >> 16));
5495 if (op == BC_ISLE || op == BC_ISGT) { 5505 if (op == BC_ISLE || op == BC_ISGT) {
5496 dasm_put(Dst, 2835); 5506 dasm_put(Dst, 2845);
5497 } 5507 }
5498 if (op == BC_ISLT || op == BC_ISLE) { 5508 if (op == BC_ISLT || op == BC_ISLE) {
5499 dasm_put(Dst, 2838); 5509 dasm_put(Dst, 2848);
5500 } else { 5510 } else {
5501 dasm_put(Dst, 2840); 5511 dasm_put(Dst, 2850);
5502 } 5512 }
5503 dasm_put(Dst, 2842); 5513 dasm_put(Dst, 2852);
5504 break; 5514 break;
5505 5515
5506 case BC_ISEQV: case BC_ISNEV: 5516 case BC_ISEQV: case BC_ISNEV:
5507 vk = op == BC_ISEQV; 5517 vk = op == BC_ISEQV;
5508 dasm_put(Dst, 2853, -(BCBIAS_J*4 >> 16)); 5518 dasm_put(Dst, 2863, -(BCBIAS_J*4 >> 16));
5509 if (vk) { 5519 if (vk) {
5510 dasm_put(Dst, 2867); 5520 dasm_put(Dst, 2877);
5511 } else { 5521 } else {
5512 dasm_put(Dst, 2869); 5522 dasm_put(Dst, 2879);
5513 } 5523 }
5514 dasm_put(Dst, 2871, ~LJ_TISPRI, ~LJ_TISTABUD); 5524 dasm_put(Dst, 2881, ~LJ_TISPRI, ~LJ_TISTABUD);
5515 if (vk) { 5525 if (vk) {
5516 dasm_put(Dst, 2893); 5526 dasm_put(Dst, 2903);
5517 } else { 5527 } else {
5518 dasm_put(Dst, 2895); 5528 dasm_put(Dst, 2905);
5519 } 5529 }
5520 dasm_put(Dst, 2897); 5530 dasm_put(Dst, 2907);
5521 if (vk) { 5531 if (vk) {
5522 dasm_put(Dst, 2899); 5532 dasm_put(Dst, 2909);
5523 } else { 5533 } else {
5524 dasm_put(Dst, 2901); 5534 dasm_put(Dst, 2911);
5525 } 5535 }
5526 dasm_put(Dst, 2903, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); 5536 dasm_put(Dst, 2913, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq);
5527 break; 5537 break;
5528 5538
5529 case BC_ISEQS: case BC_ISNES: 5539 case BC_ISEQS: case BC_ISNES:
5530 vk = op == BC_ISEQS; 5540 vk = op == BC_ISEQS;
5531 dasm_put(Dst, 2924, 32-1, -(BCBIAS_J*4 >> 16)); 5541 dasm_put(Dst, 2934, 32-1, -(BCBIAS_J*4 >> 16));
5532 if (vk) { 5542 if (vk) {
5533 dasm_put(Dst, 2938); 5543 dasm_put(Dst, 2948);
5534 } else { 5544 } else {
5535 dasm_put(Dst, 2940); 5545 dasm_put(Dst, 2950);
5536 } 5546 }
5537 dasm_put(Dst, 2942); 5547 dasm_put(Dst, 2952);
5538 break; 5548 break;
5539 5549
5540 case BC_ISEQN: case BC_ISNEN: 5550 case BC_ISEQN: case BC_ISNEN:
5541 vk = op == BC_ISEQN; 5551 vk = op == BC_ISEQN;
5542 dasm_put(Dst, 2953, -(BCBIAS_J*4 >> 16)); 5552 dasm_put(Dst, 2963, -(BCBIAS_J*4 >> 16));
5543 if (vk) { 5553 if (vk) {
5544 dasm_put(Dst, 2967); 5554 dasm_put(Dst, 2977);
5545 } else { 5555 } else {
5546 dasm_put(Dst, 2970); 5556 dasm_put(Dst, 2980);
5547 } 5557 }
5548 dasm_put(Dst, 2972); 5558 dasm_put(Dst, 2982);
5549 if (!vk) { 5559 if (!vk) {
5550 dasm_put(Dst, 2984); 5560 dasm_put(Dst, 2994);
5551 } 5561 }
5552 break; 5562 break;
5553 5563
5554 case BC_ISEQP: case BC_ISNEP: 5564 case BC_ISEQP: case BC_ISNEP:
5555 vk = op == BC_ISEQP; 5565 vk = op == BC_ISEQP;
5556 dasm_put(Dst, 2990, 32-3, -(BCBIAS_J*4 >> 16)); 5566 dasm_put(Dst, 3000, 32-3, -(BCBIAS_J*4 >> 16));
5557 if (vk) { 5567 if (vk) {
5558 dasm_put(Dst, 3002); 5568 dasm_put(Dst, 3012);
5559 } else { 5569 } else {
5560 dasm_put(Dst, 3004); 5570 dasm_put(Dst, 3014);
5561 } 5571 }
5562 dasm_put(Dst, 3006); 5572 dasm_put(Dst, 3016);
5563 break; 5573 break;
5564 5574
5565 /* -- Unary test and copy ops ------------------------------------------- */ 5575 /* -- Unary test and copy ops ------------------------------------------- */
5566 5576
5567 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 5577 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
5568 dasm_put(Dst, 3017); 5578 dasm_put(Dst, 3027);
5569 if (op == BC_IST || op == BC_ISF) { 5579 if (op == BC_IST || op == BC_ISF) {
5570 dasm_put(Dst, 3023, -(BCBIAS_J*4 >> 16)); 5580 dasm_put(Dst, 3033, -(BCBIAS_J*4 >> 16));
5571 if (op == BC_IST) { 5581 if (op == BC_IST) {
5572 dasm_put(Dst, 3028); 5582 dasm_put(Dst, 3038);
5573 } else { 5583 } else {
5574 dasm_put(Dst, 3030); 5584 dasm_put(Dst, 3040);
5575 } 5585 }
5576 } else { 5586 } else {
5577 if (op == BC_ISTC) { 5587 if (op == BC_ISTC) {
5578 dasm_put(Dst, 3032); 5588 dasm_put(Dst, 3042);
5579 } else { 5589 } else {
5580 dasm_put(Dst, 3035); 5590 dasm_put(Dst, 3045);
5581 } 5591 }
5582 dasm_put(Dst, 3038, -(BCBIAS_J*4 >> 16)); 5592 dasm_put(Dst, 3048, -(BCBIAS_J*4 >> 16));
5583 } 5593 }
5584 dasm_put(Dst, 3045); 5594 dasm_put(Dst, 3055);
5585 break; 5595 break;
5586 5596
5587 /* -- Unary ops --------------------------------------------------------- */ 5597 /* -- Unary ops --------------------------------------------------------- */
5588 5598
5589 case BC_MOV: 5599 case BC_MOV:
5590 dasm_put(Dst, 3056); 5600 dasm_put(Dst, 3066);
5591 break; 5601 break;
5592 case BC_NOT: 5602 case BC_NOT:
5593 dasm_put(Dst, 3069, LJ_TTRUE); 5603 dasm_put(Dst, 3079, LJ_TTRUE);
5594 break; 5604 break;
5595 case BC_UNM: 5605 case BC_UNM:
5596 dasm_put(Dst, 3085); 5606 dasm_put(Dst, 3095);
5597 break; 5607 break;
5598 case BC_LEN: 5608 case BC_LEN:
5599 dasm_put(Dst, 3102, Dt5(->len)); 5609 dasm_put(Dst, 3112, Dt5(->len));
5600#ifdef LUAJIT_ENABLE_LUA52COMPAT 5610#ifdef LUAJIT_ENABLE_LUA52COMPAT
5601 dasm_put(Dst, 3126, Dt6(->metatable)); 5611 dasm_put(Dst, 3136, Dt6(->metatable));
5602#endif 5612#endif
5603 dasm_put(Dst, 3133); 5613 dasm_put(Dst, 3143);
5604#ifdef LUAJIT_ENABLE_LUA52COMPAT 5614#ifdef LUAJIT_ENABLE_LUA52COMPAT
5605 dasm_put(Dst, 3139, Dt6(->nomm), 1<<MM_len); 5615 dasm_put(Dst, 3149, Dt6(->nomm), 1<<MM_len);
5606#endif 5616#endif
5607 break; 5617 break;
5608 5618
@@ -5613,262 +5623,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5613 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5623 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5614 switch (vk) { 5624 switch (vk) {
5615 case 0: 5625 case 0:
5616 dasm_put(Dst, 3149); 5626 dasm_put(Dst, 3159);
5617 break; 5627 break;
5618 case 1: 5628 case 1:
5619 dasm_put(Dst, 3155); 5629 dasm_put(Dst, 3165);
5620 break; 5630 break;
5621 default: 5631 default:
5622 dasm_put(Dst, 3161); 5632 dasm_put(Dst, 3171);
5623 break; 5633 break;
5624 } 5634 }
5625 dasm_put(Dst, 3168); 5635 dasm_put(Dst, 3178);
5626 break; 5636 break;
5627 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 5637 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
5628 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5638 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5629 switch (vk) { 5639 switch (vk) {
5630 case 0: 5640 case 0:
5631 dasm_put(Dst, 3181); 5641 dasm_put(Dst, 3191);
5632 break; 5642 break;
5633 case 1: 5643 case 1:
5634 dasm_put(Dst, 3187); 5644 dasm_put(Dst, 3197);
5635 break; 5645 break;
5636 default: 5646 default:
5637 dasm_put(Dst, 3193); 5647 dasm_put(Dst, 3203);
5638 break; 5648 break;
5639 } 5649 }
5640 dasm_put(Dst, 3200); 5650 dasm_put(Dst, 3210);
5641 break; 5651 break;
5642 case BC_MULVN: case BC_MULNV: case BC_MULVV: 5652 case BC_MULVN: case BC_MULNV: case BC_MULVV:
5643 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5653 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5644 switch (vk) { 5654 switch (vk) {
5645 case 0: 5655 case 0:
5646 dasm_put(Dst, 3213); 5656 dasm_put(Dst, 3223);
5647 break; 5657 break;
5648 case 1: 5658 case 1:
5649 dasm_put(Dst, 3219); 5659 dasm_put(Dst, 3229);
5650 break; 5660 break;
5651 default: 5661 default:
5652 dasm_put(Dst, 3225); 5662 dasm_put(Dst, 3235);
5653 break; 5663 break;
5654 } 5664 }
5655 dasm_put(Dst, 3232); 5665 dasm_put(Dst, 3242);
5656 break; 5666 break;
5657 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 5667 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
5658 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5668 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5659 switch (vk) { 5669 switch (vk) {
5660 case 0: 5670 case 0:
5661 dasm_put(Dst, 3245); 5671 dasm_put(Dst, 3255);
5662 break; 5672 break;
5663 case 1: 5673 case 1:
5664 dasm_put(Dst, 3251); 5674 dasm_put(Dst, 3261);
5665 break; 5675 break;
5666 default: 5676 default:
5667 dasm_put(Dst, 3257); 5677 dasm_put(Dst, 3267);
5668 break; 5678 break;
5669 } 5679 }
5670 dasm_put(Dst, 3264); 5680 dasm_put(Dst, 3274);
5671 break; 5681 break;
5672 case BC_MODVN: 5682 case BC_MODVN:
5673 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5683 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5674 switch (vk) { 5684 switch (vk) {
5675 case 0: 5685 case 0:
5676 dasm_put(Dst, 3277); 5686 dasm_put(Dst, 3287);
5677 break; 5687 break;
5678 case 1: 5688 case 1:
5679 dasm_put(Dst, 3283); 5689 dasm_put(Dst, 3293);
5680 break; 5690 break;
5681 default: 5691 default:
5682 dasm_put(Dst, 3289); 5692 dasm_put(Dst, 3299);
5683 break; 5693 break;
5684 } 5694 }
5685 dasm_put(Dst, 3296); 5695 dasm_put(Dst, 3306);
5686 break; 5696 break;
5687 case BC_MODNV: case BC_MODVV: 5697 case BC_MODNV: case BC_MODVV:
5688 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5698 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5689 switch (vk) { 5699 switch (vk) {
5690 case 0: 5700 case 0:
5691 dasm_put(Dst, 3314); 5701 dasm_put(Dst, 3324);
5692 break; 5702 break;
5693 case 1: 5703 case 1:
5694 dasm_put(Dst, 3320); 5704 dasm_put(Dst, 3330);
5695 break; 5705 break;
5696 default: 5706 default:
5697 dasm_put(Dst, 3326); 5707 dasm_put(Dst, 3336);
5698 break; 5708 break;
5699 } 5709 }
5700 dasm_put(Dst, 3333); 5710 dasm_put(Dst, 3343);
5701 break; 5711 break;
5702 case BC_POW: 5712 case BC_POW:
5703 dasm_put(Dst, 3336); 5713 dasm_put(Dst, 3346);
5704 break; 5714 break;
5705 5715
5706 case BC_CAT: 5716 case BC_CAT:
5707 dasm_put(Dst, 3358, Dt1(->base), 32-3, Dt1(->base)); 5717 dasm_put(Dst, 3368, Dt1(->base), 32-3, Dt1(->base));
5708 break; 5718 break;
5709 5719
5710 /* -- Constant ops ------------------------------------------------------ */ 5720 /* -- Constant ops ------------------------------------------------------ */
5711 5721
5712 case BC_KSTR: 5722 case BC_KSTR:
5713 dasm_put(Dst, 3388, 32-1); 5723 dasm_put(Dst, 3398, 32-1);
5714 break; 5724 break;
5715 case BC_KCDATA: 5725 case BC_KCDATA:
5716#if LJ_HASFFI 5726#if LJ_HASFFI
5717 dasm_put(Dst, 3405, 32-1, LJ_TCDATA); 5727 dasm_put(Dst, 3415, 32-1, LJ_TCDATA);
5718#endif 5728#endif
5719 break; 5729 break;
5720 case BC_KSHORT: 5730 case BC_KSHORT:
5721 dasm_put(Dst, 3424, 32-3); 5731 dasm_put(Dst, 3434, 32-3);
5722 break; 5732 break;
5723 case BC_KNUM: 5733 case BC_KNUM:
5724 dasm_put(Dst, 3440); 5734 dasm_put(Dst, 3450);
5725 break; 5735 break;
5726 case BC_KPRI: 5736 case BC_KPRI:
5727 dasm_put(Dst, 3453, 32-3); 5737 dasm_put(Dst, 3463, 32-3);
5728 break; 5738 break;
5729 case BC_KNIL: 5739 case BC_KNIL:
5730 dasm_put(Dst, 3468); 5740 dasm_put(Dst, 3478);
5731 break; 5741 break;
5732 5742
5733 /* -- Upvalue and function ops ------------------------------------------ */ 5743 /* -- Upvalue and function ops ------------------------------------------ */
5734 5744
5735 case BC_UGET: 5745 case BC_UGET:
5736 dasm_put(Dst, 3487, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5746 dasm_put(Dst, 3497, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5737 break; 5747 break;
5738 case BC_USETV: 5748 case BC_USETV:
5739 dasm_put(Dst, 3508, 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); 5749 dasm_put(Dst, 3518, 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);
5740 break; 5750 break;
5741 case BC_USETS: 5751 case BC_USETS:
5742 dasm_put(Dst, 3560, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); 5752 dasm_put(Dst, 3570, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G);
5743 break; 5753 break;
5744 case BC_USETN: 5754 case BC_USETN:
5745 dasm_put(Dst, 3609, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5755 dasm_put(Dst, 3619, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5746 break; 5756 break;
5747 case BC_USETP: 5757 case BC_USETP:
5748 dasm_put(Dst, 3630, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); 5758 dasm_put(Dst, 3640, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v));
5749 break; 5759 break;
5750 5760
5751 case BC_UCLO: 5761 case BC_UCLO:
5752 dasm_put(Dst, 3653, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); 5762 dasm_put(Dst, 3663, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
5753 break; 5763 break;
5754 5764
5755 case BC_FNEW: 5765 case BC_FNEW:
5756 dasm_put(Dst, 3683, 32-1, Dt1(->base), Dt1(->base)); 5766 dasm_put(Dst, 3693, 32-1, Dt1(->base), Dt1(->base));
5757 break; 5767 break;
5758 5768
5759 /* -- Table ops --------------------------------------------------------- */ 5769 /* -- Table ops --------------------------------------------------------- */
5760 5770
5761 case BC_TNEW: 5771 case BC_TNEW:
5762 case BC_TDUP: 5772 case BC_TDUP:
5763 dasm_put(Dst, 3709, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); 5773 dasm_put(Dst, 3719, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
5764 if (op == BC_TNEW) { 5774 if (op == BC_TNEW) {
5765 dasm_put(Dst, 3722); 5775 dasm_put(Dst, 3732);
5766 } else { 5776 } else {
5767 dasm_put(Dst, 3730, 32-1); 5777 dasm_put(Dst, 3740, 32-1);
5768 } 5778 }
5769 dasm_put(Dst, 3737, Dt1(->base)); 5779 dasm_put(Dst, 3747, Dt1(->base));
5770 break; 5780 break;
5771 5781
5772 case BC_GGET: 5782 case BC_GGET:
5773 case BC_GSET: 5783 case BC_GSET:
5774 dasm_put(Dst, 3760, 32-1, Dt7(->env)); 5784 dasm_put(Dst, 3770, 32-1, Dt7(->env));
5775 if (op == BC_GGET) { 5785 if (op == BC_GGET) {
5776 dasm_put(Dst, 3768); 5786 dasm_put(Dst, 3778);
5777 } else { 5787 } else {
5778 dasm_put(Dst, 3771); 5788 dasm_put(Dst, 3781);
5779 } 5789 }
5780 break; 5790 break;
5781 5791
5782 case BC_TGETV: 5792 case BC_TGETV:
5783 dasm_put(Dst, 3774, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5793 dasm_put(Dst, 3784, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5784 break; 5794 break;
5785 case BC_TGETS: 5795 case BC_TGETS:
5786 dasm_put(Dst, 3832, 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); 5796 dasm_put(Dst, 3842, 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);
5787 dasm_put(Dst, 3896); 5797 dasm_put(Dst, 3906);
5788 break; 5798 break;
5789 case BC_TGETB: 5799 case BC_TGETB:
5790 dasm_put(Dst, 3901, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5800 dasm_put(Dst, 3911, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5791 break; 5801 break;
5792 5802
5793 case BC_TSETV: 5803 case BC_TSETV:
5794 dasm_put(Dst, 3945, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 5804 dasm_put(Dst, 3955, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
5795 dasm_put(Dst, 4012, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 5805 dasm_put(Dst, 4022, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
5796 break; 5806 break;
5797 case BC_TSETS: 5807 case BC_TSETS:
5798 dasm_put(Dst, 4024, 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)); 5808 dasm_put(Dst, 4034, 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));
5799 dasm_put(Dst, 4085, 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)); 5809 dasm_put(Dst, 4095, 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));
5800 dasm_put(Dst, 4136, Dt6(->marked), Dt6(->gclist)); 5810 dasm_put(Dst, 4146, Dt6(->marked), Dt6(->gclist));
5801 break; 5811 break;
5802 case BC_TSETB: 5812 case BC_TSETB:
5803 dasm_put(Dst, 4143, 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)); 5813 dasm_put(Dst, 4153, 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));
5804 dasm_put(Dst, 4203, Dt6(->gclist)); 5814 dasm_put(Dst, 4213, Dt6(->gclist));
5805 break; 5815 break;
5806 5816
5807 case BC_TSETM: 5817 case BC_TSETM:
5808 dasm_put(Dst, 4208, 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)); 5818 dasm_put(Dst, 4218, 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));
5809 dasm_put(Dst, 4277); 5819 dasm_put(Dst, 4287);
5810 break; 5820 break;
5811 5821
5812 /* -- Calls and vararg handling ----------------------------------------- */ 5822 /* -- Calls and vararg handling ----------------------------------------- */
5813 5823
5814 case BC_CALLM: 5824 case BC_CALLM:
5815 dasm_put(Dst, 4280); 5825 dasm_put(Dst, 4290);
5816 break; 5826 break;
5817 case BC_CALL: 5827 case BC_CALL:
5818 dasm_put(Dst, 4282, Dt7(->pc)); 5828 dasm_put(Dst, 4292, Dt7(->pc));
5819 break; 5829 break;
5820 5830
5821 case BC_CALLMT: 5831 case BC_CALLMT:
5822 dasm_put(Dst, 4302); 5832 dasm_put(Dst, 4312);
5823 break; 5833 break;
5824 case BC_CALLT: 5834 case BC_CALLT:
5825 dasm_put(Dst, 4304, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5835 dasm_put(Dst, 4314, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5826 dasm_put(Dst, 4369, FRAME_TYPE); 5836 dasm_put(Dst, 4379, FRAME_TYPE);
5827 break; 5837 break;
5828 5838
5829 case BC_ITERC: 5839 case BC_ITERC:
5830 dasm_put(Dst, 4376, Dt7(->pc)); 5840 dasm_put(Dst, 4386, Dt7(->pc));
5831 break; 5841 break;
5832 5842
5833 case BC_ITERN: 5843 case BC_ITERN:
5834#if LJ_HASJIT 5844#if LJ_HASJIT
5835#endif 5845#endif
5836 dasm_put(Dst, 4402, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); 5846 dasm_put(Dst, 4412, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16));
5837 dasm_put(Dst, 4481); 5847 dasm_put(Dst, 4491);
5838 break; 5848 break;
5839 5849
5840 case BC_ISNEXT: 5850 case BC_ISNEXT:
5841 dasm_put(Dst, 4485, 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)); 5851 dasm_put(Dst, 4495, 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));
5842 break; 5852 break;
5843 5853
5844 case BC_VARG: 5854 case BC_VARG:
5845 dasm_put(Dst, 4536, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); 5855 dasm_put(Dst, 4546, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
5846 dasm_put(Dst, 4616); 5856 dasm_put(Dst, 4626);
5847 break; 5857 break;
5848 5858
5849 /* -- Returns ----------------------------------------------------------- */ 5859 /* -- Returns ----------------------------------------------------------- */
5850 5860
5851 case BC_RETM: 5861 case BC_RETM:
5852 dasm_put(Dst, 4622); 5862 dasm_put(Dst, 4632);
5853 break; 5863 break;
5854 5864
5855 case BC_RET: 5865 case BC_RET:
5856 dasm_put(Dst, 4624, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5866 dasm_put(Dst, 4634, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5857 break; 5867 break;
5858 5868
5859 case BC_RET0: case BC_RET1: 5869 case BC_RET0: case BC_RET1:
5860 dasm_put(Dst, 4694, FRAME_TYPE, FRAME_VARG); 5870 dasm_put(Dst, 4704, FRAME_TYPE, FRAME_VARG);
5861 if (op == BC_RET1) { 5871 if (op == BC_RET1) {
5862 dasm_put(Dst, 4707); 5872 dasm_put(Dst, 4717);
5863 } 5873 }
5864 dasm_put(Dst, 4710, Dt7(->pc), PC2PROTO(k)); 5874 dasm_put(Dst, 4720, Dt7(->pc), PC2PROTO(k));
5865 break; 5875 break;
5866 5876
5867 /* -- Loops and branches ------------------------------------------------ */ 5877 /* -- Loops and branches ------------------------------------------------ */
5868 5878
5869 case BC_FORL: 5879 case BC_FORL:
5870#if LJ_HASJIT 5880#if LJ_HASJIT
5871 dasm_put(Dst, 4738); 5881 dasm_put(Dst, 4748);
5872#endif 5882#endif
5873 break; 5883 break;
5874 5884
@@ -5880,35 +5890,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5880 case BC_FORI: 5890 case BC_FORI:
5881 case BC_IFORL: 5891 case BC_IFORL:
5882 vk = (op == BC_IFORL || op == BC_JFORL); 5892 vk = (op == BC_IFORL || op == BC_JFORL);
5883 dasm_put(Dst, 4740, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); 5893 dasm_put(Dst, 4750, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
5884 if (!vk) { 5894 if (!vk) {
5885 dasm_put(Dst, 4748); 5895 dasm_put(Dst, 4758);
5886 } 5896 }
5887 if (vk) { 5897 if (vk) {
5888 dasm_put(Dst, 4756, FORL_IDX*8); 5898 dasm_put(Dst, 4766, FORL_IDX*8);
5889 } 5899 }
5890 dasm_put(Dst, 4760, FORL_EXT*8); 5900 dasm_put(Dst, 4770, FORL_EXT*8);
5891 if (op != BC_JFORL) { 5901 if (op != BC_JFORL) {
5892 dasm_put(Dst, 4768, 32-1); 5902 dasm_put(Dst, 4778, 32-1);
5893 if (op == BC_JFORI) { 5903 if (op == BC_JFORI) {
5894 dasm_put(Dst, 4772, -(BCBIAS_J*4 >> 16)); 5904 dasm_put(Dst, 4782, -(BCBIAS_J*4 >> 16));
5895 } else { 5905 } else {
5896 dasm_put(Dst, 4775, -(BCBIAS_J*4 >> 16)); 5906 dasm_put(Dst, 4785, -(BCBIAS_J*4 >> 16));
5897 } 5907 }
5898 } 5908 }
5899 if (op == BC_FORI) { 5909 if (op == BC_FORI) {
5900 dasm_put(Dst, 4778); 5910 dasm_put(Dst, 4788);
5901 } else if (op == BC_IFORL) { 5911 } else if (op == BC_IFORL) {
5902 dasm_put(Dst, 4780); 5912 dasm_put(Dst, 4790);
5903 } else { 5913 } else {
5904 dasm_put(Dst, 4782, BC_JLOOP); 5914 dasm_put(Dst, 4792, BC_JLOOP);
5905 } 5915 }
5906 dasm_put(Dst, 4785); 5916 dasm_put(Dst, 4795);
5907 break; 5917 break;
5908 5918
5909 case BC_ITERL: 5919 case BC_ITERL:
5910#if LJ_HASJIT 5920#if LJ_HASJIT
5911 dasm_put(Dst, 4800); 5921 dasm_put(Dst, 4810);
5912#endif 5922#endif
5913 break; 5923 break;
5914 5924
@@ -5917,40 +5927,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5917 break; 5927 break;
5918#endif 5928#endif
5919 case BC_IITERL: 5929 case BC_IITERL:
5920 dasm_put(Dst, 4802); 5930 dasm_put(Dst, 4812);
5921 if (op == BC_JITERL) { 5931 if (op == BC_JITERL) {
5922 dasm_put(Dst, 4808); 5932 dasm_put(Dst, 4818);
5923 } else { 5933 } else {
5924 dasm_put(Dst, 4810, 32-1, -(BCBIAS_J*4 >> 16)); 5934 dasm_put(Dst, 4820, 32-1, -(BCBIAS_J*4 >> 16));
5925 } 5935 }
5926 dasm_put(Dst, 4817); 5936 dasm_put(Dst, 4827);
5927 break; 5937 break;
5928 5938
5929 case BC_LOOP: 5939 case BC_LOOP:
5930#if LJ_HASJIT 5940#if LJ_HASJIT
5931 dasm_put(Dst, 4829); 5941 dasm_put(Dst, 4839);
5932#endif 5942#endif
5933 break; 5943 break;
5934 5944
5935 case BC_ILOOP: 5945 case BC_ILOOP:
5936 dasm_put(Dst, 4831); 5946 dasm_put(Dst, 4841);
5937 break; 5947 break;
5938 5948
5939 case BC_JLOOP: 5949 case BC_JLOOP:
5940#if LJ_HASJIT 5950#if LJ_HASJIT
5941 dasm_put(Dst, 4842); 5951 dasm_put(Dst, 4852);
5942#endif 5952#endif
5943 break; 5953 break;
5944 5954
5945 case BC_JMP: 5955 case BC_JMP:
5946 dasm_put(Dst, 4844, 32-1, -(BCBIAS_J*4 >> 16)); 5956 dasm_put(Dst, 4854, 32-1, -(BCBIAS_J*4 >> 16));
5947 break; 5957 break;
5948 5958
5949 /* -- Function headers -------------------------------------------------- */ 5959 /* -- Function headers -------------------------------------------------- */
5950 5960
5951 case BC_FUNCF: 5961 case BC_FUNCF:
5952#if LJ_HASJIT 5962#if LJ_HASJIT
5953 dasm_put(Dst, 4860); 5963 dasm_put(Dst, 4870);
5954#endif 5964#endif
5955 case BC_FUNCV: /* NYI: compiled vararg functions. */ 5965 case BC_FUNCV: /* NYI: compiled vararg functions. */
5956 break; 5966 break;
@@ -5960,38 +5970,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5960 break; 5970 break;
5961#endif 5971#endif
5962 case BC_IFUNCF: 5972 case BC_IFUNCF:
5963 dasm_put(Dst, 4862, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); 5973 dasm_put(Dst, 4872, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
5964 if (op == BC_JFUNCF) { 5974 if (op == BC_JFUNCF) {
5965 dasm_put(Dst, 4880); 5975 dasm_put(Dst, 4890);
5966 } else { 5976 } else {
5967 dasm_put(Dst, 4882); 5977 dasm_put(Dst, 4892);
5968 } 5978 }
5969 dasm_put(Dst, 4891); 5979 dasm_put(Dst, 4901);
5970 break; 5980 break;
5971 5981
5972 case BC_JFUNCV: 5982 case BC_JFUNCV:
5973#if !LJ_HASJIT 5983#if !LJ_HASJIT
5974 break; 5984 break;
5975#endif 5985#endif
5976 dasm_put(Dst, 4897); 5986 dasm_put(Dst, 4907);
5977 break; /* NYI: compiled vararg functions. */ 5987 break; /* NYI: compiled vararg functions. */
5978 5988
5979 case BC_IFUNCV: 5989 case BC_IFUNCV:
5980 dasm_put(Dst, 4899, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); 5990 dasm_put(Dst, 4909, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams));
5981 break; 5991 break;
5982 5992
5983 case BC_FUNCC: 5993 case BC_FUNCC:
5984 case BC_FUNCCW: 5994 case BC_FUNCCW:
5985 if (op == BC_FUNCC) { 5995 if (op == BC_FUNCC) {
5986 dasm_put(Dst, 4949, Dt8(->f)); 5996 dasm_put(Dst, 4959, Dt8(->f));
5987 } else { 5997 } else {
5988 dasm_put(Dst, 4952, DISPATCH_GL(wrapf)); 5998 dasm_put(Dst, 4962, DISPATCH_GL(wrapf));
5989 } 5999 }
5990 dasm_put(Dst, 4955, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); 6000 dasm_put(Dst, 4965, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
5991 if (op == BC_FUNCCW) { 6001 if (op == BC_FUNCCW) {
5992 dasm_put(Dst, 4968, Dt8(->f)); 6002 dasm_put(Dst, 4978, Dt8(->f));
5993 } 6003 }
5994 dasm_put(Dst, 4971, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); 6004 dasm_put(Dst, 4981, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
5995 break; 6005 break;
5996 6006
5997 /* ---------------------------------------------------------------------- */ 6007 /* ---------------------------------------------------------------------- */
@@ -6011,7 +6021,7 @@ static int build_backend(BuildCtx *ctx)
6011 6021
6012 build_subroutines(ctx); 6022 build_subroutines(ctx);
6013 6023
6014 dasm_put(Dst, 4992); 6024 dasm_put(Dst, 5002);
6015 for (op = 0; op < BC__MAX; op++) 6025 for (op = 0; op < BC__MAX; op++)
6016 build_ins(ctx, (BCOp)op, op); 6026 build_ins(ctx, (BCOp)op, op);
6017 6027
@@ -6046,7 +6056,8 @@ static void emit_asm_debug(BuildCtx *ctx)
6046 "\t.long .Lbegin\n" 6056 "\t.long .Lbegin\n"
6047 "\t.long %d\n" 6057 "\t.long %d\n"
6048 "\t.byte 0xe\n\t.uleb128 %d\n" 6058 "\t.byte 0xe\n\t.uleb128 %d\n"
6049 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", 6059 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
6060 "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
6050 (int)ctx->codesz, CFRAME_SIZE); 6061 (int)ctx->codesz, CFRAME_SIZE);
6051 for (i = 14; i <= 31; i++) 6062 for (i = 14; i <= 31; i++)
6052 fprintf(ctx->fp, 6063 fprintf(ctx->fp,
@@ -6083,7 +6094,8 @@ static void emit_asm_debug(BuildCtx *ctx)
6083 "\t.long %d\n" 6094 "\t.long %d\n"
6084 "\t.uleb128 0\n" /* augmentation length */ 6095 "\t.uleb128 0\n" /* augmentation length */
6085 "\t.byte 0xe\n\t.uleb128 %d\n" 6096 "\t.byte 0xe\n\t.uleb128 %d\n"
6086 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", 6097 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
6098 "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n",
6087 (int)ctx->codesz, CFRAME_SIZE); 6099 (int)ctx->codesz, CFRAME_SIZE);
6088 for (i = 14; i <= 31; i++) 6100 for (i = 14; i <= 31; i++)
6089 fprintf(ctx->fp, 6101 fprintf(ctx->fp,
diff --git a/src/lj_ccall.c b/src/lj_ccall.c
index 183e471c..3ec5b1cc 100644
--- a/src/lj_ccall.c
+++ b/src/lj_ccall.c
@@ -578,7 +578,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct,
578 } 578 }
579 if (fid) lj_err_caller(L, LJ_ERR_FFI_NUMARG); /* Too few arguments. */ 579 if (fid) lj_err_caller(L, LJ_ERR_FFI_NUMARG); /* Too few arguments. */
580 580
581#if LJ_TARGET_X64 || LJ_TARGET_PPC || LJ_TARGET_PPCSPE 581#if LJ_TARGET_X64 || LJ_TARGET_PPC
582 cc->nfpr = nfpr; /* Required for vararg functions. */ 582 cc->nfpr = nfpr; /* Required for vararg functions. */
583#endif 583#endif
584 cc->nsp = nsp; 584 cc->nsp = nsp;
diff --git a/src/lj_ccall.h b/src/lj_ccall.h
index 9a927745..d9b1e42c 100644
--- a/src/lj_ccall.h
+++ b/src/lj_ccall.h
@@ -112,7 +112,7 @@ typedef struct CCallState {
112 uint8_t nfpr; /* Number of arguments in FPRs. */ 112 uint8_t nfpr; /* Number of arguments in FPRs. */
113#elif LJ_TARGET_X86 113#elif LJ_TARGET_X86
114 uint8_t resx87; /* Result on x87 stack: 1:float, 2:double. */ 114 uint8_t resx87; /* Result on x87 stack: 1:float, 2:double. */
115#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE 115#elif LJ_TARGET_PPC
116 uint8_t nfpr; /* Number of arguments in FPRs. */ 116 uint8_t nfpr; /* Number of arguments in FPRs. */
117#endif 117#endif
118#if CCALL_NUM_FPR 118#if CCALL_NUM_FPR
diff --git a/src/lj_frame.h b/src/lj_frame.h
index b8b7a727..89484565 100644
--- a/src/lj_frame.h
+++ b/src/lj_frame.h
@@ -115,7 +115,7 @@ enum {
115#define CFRAME_OFS_L 16 115#define CFRAME_OFS_L 16
116#define CFRAME_OFS_PC 12 116#define CFRAME_OFS_PC 12
117#define CFRAME_OFS_MULTRES 8 117#define CFRAME_OFS_MULTRES 8
118#define CFRAME_SIZE 176 118#define CFRAME_SIZE 184
119#define CFRAME_SHIFT_MULTRES 3 119#define CFRAME_SHIFT_MULTRES 3
120#else 120#else
121#error "Missing CFRAME_* definitions for this architecture" 121#error "Missing CFRAME_* definitions for this architecture"