Optimize BC_VARG: use RC for numparams.

This commit is contained in:
Mike Pall 2010-09-10 11:34:29 +02:00
parent 96957a4551
commit 6fd315581c
6 changed files with 333 additions and 339 deletions

View File

@ -12,7 +12,7 @@
#define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1 #define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2 #define DASM_MAXSECTION 2
static const unsigned char build_actionlist[14095] = { static const unsigned char build_actionlist[14087] = {
254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141, 254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141,
76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4, 76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4,
252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133, 252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133,
@ -641,59 +641,59 @@ static const unsigned char build_actionlist[14095] = {
105,8,137,65,12,139,105,224,139,65,228,137,105,252,248,137,65,252,252,129, 105,8,137,65,12,139,105,224,139,65,228,137,105,252,248,137,65,252,252,129,
252,248,239,184,237,15,133,244,28,137,202,137,90,252,252,139,157,233,139, 252,248,239,184,237,15,133,244,28,137,202,137,90,252,252,139,157,233,139,
11,15,182,252,233,15,182,205,131,195,4,65,252,255,36,252,238,255,15,182,252, 11,15,182,252,233,15,182,205,131,195,4,65,252,255,36,252,238,255,15,182,252,
236,139,66,252,248,141,12,202,139,128,233,15,182,128,233,68,137,60,36,68, 236,15,182,192,68,137,60,36,68,141,188,253,194,233,141,12,202,68,43,122,252,
141,188,253,194,233,68,43,122,252,252,133,252,237,15,132,244,251,141,108, 252,133,252,237,15,132,244,251,141,108,252,233,252,248,65,57,215,15,131,244,
252,233,252,248,65,57,215,15,131,244,248,248,1,65,139,71,252,248,137,1,65, 248,248,1,65,139,71,252,248,137,1,65,139,71,252,252,65,131,199,8,137,65,4,
139,71,252,252,65,131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249, 131,193,8,57,252,233,15,131,244,249,65,57,215,15,130,244,1,248,2,199,65,4,
65,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244, 237,131,193,8,57,252,233,15,130,244,2,248,3,68,139,60,36,139,3,15,182,204,
2,248,3,68,139,60,36,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65, 15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,5,199,68,36,4,1,
252,255,36,252,238,248,5,199,68,36,4,1,0,0,0,137,208,68,41,252,248,15,134, 0,0,0,137,208,68,41,252,248,15,134,244,3,137,197,193,252,237,3,131,197,1,
244,3,255,137,197,193,252,237,3,131,197,1,137,108,36,4,139,108,36,24,1,200, 137,108,36,4,139,108,36,24,1,200,59,133,233,15,135,244,253,248,6,255,65,139,
59,133,233,15,135,244,253,248,6,65,139,71,252,248,137,1,65,139,71,252,252, 71,252,248,137,1,65,139,71,252,252,65,131,199,8,137,65,4,131,193,8,65,57,
65,131,199,8,137,65,4,131,193,8,65,57,215,15,130,244,6,252,233,244,3,248, 215,15,130,244,6,252,233,244,3,248,7,137,149,233,137,141,233,137,92,36,28,
7,137,149,233,137,141,233,137,92,36,28,65,41,215,139,116,36,4,131,252,238, 65,41,215,139,116,36,4,131,252,238,1,137,252,239,232,251,1,0,139,149,233,
1,137,252,239,232,251,1,0,139,149,233,139,141,233,65,1,215,252,233,244,6, 139,141,233,65,1,215,252,233,244,6,255,193,225,3,255,248,1,139,90,252,252,
255,193,225,3,255,248,1,139,90,252,252,137,68,36,4,252,247,195,237,15,133, 137,68,36,4,252,247,195,237,15,133,244,253,255,248,13,65,137,215,131,232,
244,253,255,248,13,65,137,215,131,232,1,15,132,244,249,248,2,65,139,44,15, 1,15,132,244,249,248,2,65,139,44,15,65,137,111,252,248,65,139,108,15,4,65,
65,137,111,252,248,65,139,108,15,4,65,137,111,252,252,65,131,199,8,131,232, 137,111,252,252,65,131,199,8,131,232,1,15,133,244,2,248,3,139,68,36,4,15,
1,15,133,244,2,248,3,139,68,36,4,15,182,107,252,255,248,5,57,197,15,135,244, 182,107,252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,106,252,
252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,248,5, 252,139,44,10,137,106,252,248,255,248,5,56,67,252,255,15,135,244,252,255,
56,67,252,255,15,135,244,252,255,15,182,75,252,253,72,252,247,209,141,20, 15,182,75,252,253,72,252,247,209,141,20,202,68,139,122,252,248,69,139,191,
202,68,139,122,252,248,69,139,191,233,69,139,191,233,139,3,15,182,204,15, 233,69,139,191,233,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,
182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,6,255,65,199,71,252, 255,36,252,238,248,6,255,65,199,71,252,252,237,65,131,199,8,255,199,68,194,
252,237,65,131,199,8,255,199,68,194,252,244,237,255,131,192,1,252,233,244, 252,244,237,255,131,192,1,252,233,244,5,248,7,141,171,233,252,247,197,237,
5,248,7,141,171,233,252,247,197,237,15,133,244,14,41,252,234,255,1,252,233, 15,133,244,14,41,252,234,255,1,252,233,255,137,221,209,252,237,129,229,239,
255,137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1,15,132,244, 102,65,131,172,253,46,233,1,15,132,244,140,255,141,12,202,255,129,121,253,
140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,129,121,253,12,239, 4,239,15,135,244,53,129,121,253,12,239,15,135,244,53,255,139,105,20,255,129,
15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,244,53,255,252,242, 252,253,239,15,135,244,53,255,252,242,15,16,1,252,242,15,16,73,8,255,252,
15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252, 242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,
237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15, 249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,
17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15, 65,16,221,17,221,81,24,133,252,237,15,136,244,247,255,221,81,24,15,140,244,
136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,67, 247,255,217,201,248,1,255,15,183,67,252,254,255,15,131,244,248,141,156,253,
252,254,255,15,131,244,248,141,156,253,131,233,255,141,156,253,131,233,15, 131,233,255,141,156,253,131,233,15,183,67,252,254,15,131,245,255,15,130,244,
183,67,252,254,15,131,245,255,15,130,244,248,141,156,253,131,233,255,248, 248,141,156,253,131,233,255,248,3,102,15,46,193,252,233,244,1,255,141,12,
3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253,239,15, 202,139,105,4,129,252,253,239,15,132,244,247,255,137,105,252,252,139,41,137,
132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245,255,141, 105,252,248,252,233,245,255,141,156,253,131,233,139,1,137,105,252,252,137,
156,253,131,233,139,1,137,105,252,252,137,65,252,248,255,65,139,142,233,139, 65,252,248,255,65,139,142,233,139,4,129,72,139,128,233,139,108,36,24,65,137,
4,129,72,139,128,233,139,108,36,24,65,137,150,233,65,137,174,233,76,137,36, 150,233,65,137,174,233,76,137,36,36,76,137,108,36,8,72,131,252,236,16,252,
36,76,137,108,36,8,72,131,252,236,16,252,255,224,255,141,156,253,131,233, 255,224,255,141,156,253,131,233,139,3,15,182,204,15,182,232,131,195,4,193,
139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255, 232,16,65,252,255,36,252,238,255,137,221,209,252,237,129,229,239,102,65,131,
137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1,15,132,244,142, 172,253,46,233,1,15,132,244,142,255,68,139,187,233,139,108,36,24,141,12,202,
255,68,139,187,233,139,108,36,24,141,12,202,59,141,233,15,135,244,23,15,182, 59,141,233,15,135,244,23,15,182,139,233,57,200,15,134,244,249,248,2,255,15,
139,233,57,200,15,134,244,249,248,2,255,15,183,67,252,254,252,233,245,255, 183,67,252,254,252,233,245,255,248,3,199,68,194,252,252,237,131,192,1,57,
248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233,244,2, 200,15,134,244,3,252,233,244,2,255,141,44,197,237,141,4,194,68,139,122,252,
255,141,44,197,237,141,4,194,68,139,122,252,248,137,104,252,252,68,137,120, 248,137,104,252,252,68,137,120,252,248,139,108,36,24,141,12,200,59,141,233,
252,248,139,108,36,24,141,12,200,59,141,233,15,135,244,22,137,209,137,194, 15,135,244,22,137,209,137,194,15,182,171,233,133,252,237,15,132,244,248,248,
15,182,171,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209,15,131,244, 1,131,193,8,57,209,15,131,244,249,68,139,121,252,248,68,137,56,68,139,121,
249,68,139,121,252,248,68,137,56,68,139,121,252,252,68,137,120,4,131,192, 252,252,68,137,120,4,131,192,8,199,65,252,252,237,131,252,237,1,15,133,244,
8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,68,139,187,233, 1,248,2,255,68,139,187,233,139,3,15,182,204,15,182,232,131,195,4,193,232,
139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255, 16,65,252,255,36,252,238,255,248,3,199,64,4,237,131,192,8,131,252,237,1,15,
248,3,199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255, 133,244,3,252,233,244,2,255,139,106,252,248,76,139,189,233,139,108,36,24,
139,106,252,248,76,139,189,233,139,108,36,24,141,68,194,252,248,137,149,233, 141,68,194,252,248,137,149,233,141,136,233,59,141,233,137,133,233,255,137,
141,136,233,59,141,233,137,133,233,255,137,252,239,255,76,137,252,254,137, 252,239,255,76,137,252,254,137,252,239,255,15,135,244,21,65,199,134,233,237,
252,239,255,15,135,244,21,65,199,134,233,237,255,65,252,255,215,255,65,252, 255,65,252,255,215,255,65,252,255,150,233,255,65,199,134,233,237,139,149,
255,150,233,255,65,199,134,233,237,139,149,233,141,12,194,252,247,217,3,141, 233,141,12,194,252,247,217,3,141,233,139,90,252,252,252,233,244,12,255,254,
233,139,90,252,252,252,233,244,12,255,254,0 0
}; };
enum { enum {
@ -1989,8 +1989,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 13006, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 13006, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
dasm_put(Dst, 13160, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 13180, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
@ -2001,30 +2001,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_RET: case BC_RET0: case BC_RET1: case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13265); dasm_put(Dst, 13257);
} }
dasm_put(Dst, 13269, FRAME_TYPE); dasm_put(Dst, 13261, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 13288); dasm_put(Dst, 13280);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 13352); dasm_put(Dst, 13344);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 13368); dasm_put(Dst, 13360);
default: default:
break; break;
} }
dasm_put(Dst, 13379, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 13371, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 13427, LJ_TNIL); dasm_put(Dst, 13419, LJ_TNIL);
} else { } else {
dasm_put(Dst, 13438, LJ_TNIL); dasm_put(Dst, 13430, LJ_TNIL);
} }
dasm_put(Dst, 13445, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 13437, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13469); dasm_put(Dst, 13461);
} }
dasm_put(Dst, 4599); dasm_put(Dst, 4599);
break; break;
@ -2034,7 +2034,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL: case BC_FORL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13465, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2046,57 +2046,57 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI: case BC_FORI:
case BC_IFORL: case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL); vk = (op == BC_IFORL || op == BC_JFORL);
dasm_put(Dst, 13494); dasm_put(Dst, 13486);
if (!vk) { if (!vk) {
dasm_put(Dst, 13498, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 13490, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 13517); dasm_put(Dst, 13509);
if (!vk) { if (!vk) {
dasm_put(Dst, 13521, LJ_TISNUM); dasm_put(Dst, 13513, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 13530); dasm_put(Dst, 13522);
if (vk) { if (vk) {
dasm_put(Dst, 13542); dasm_put(Dst, 13534);
} else { } else {
dasm_put(Dst, 13561); dasm_put(Dst, 13553);
} }
dasm_put(Dst, 13566); dasm_put(Dst, 13558);
} else { } else {
dasm_put(Dst, 13579); dasm_put(Dst, 13571);
if (vk) { if (vk) {
dasm_put(Dst, 13585); dasm_put(Dst, 13577);
} else { } else {
dasm_put(Dst, 13593);
}
dasm_put(Dst, 13601); dasm_put(Dst, 13601);
}
dasm_put(Dst, 13609);
if (cmov) { if (cmov) {
dasm_put(Dst, 9528); dasm_put(Dst, 9528);
} else { } else {
dasm_put(Dst, 9534); dasm_put(Dst, 9534);
} }
if (!cmov) { if (!cmov) {
dasm_put(Dst, 13614); dasm_put(Dst, 13606);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 13620, -BCBIAS_J*4); dasm_put(Dst, 13612, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 13630, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 13622, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 13644, -BCBIAS_J*4); dasm_put(Dst, 13636, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 13640, BC_JLOOP); dasm_put(Dst, 13632, BC_JLOOP);
} }
dasm_put(Dst, 9563); dasm_put(Dst, 9563);
if (sse) { if (sse) {
dasm_put(Dst, 13654); dasm_put(Dst, 13646);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13465, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2105,18 +2105,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IITERL: case BC_IITERL:
dasm_put(Dst, 13665, LJ_TNIL); dasm_put(Dst, 13657, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 13680, BC_JLOOP); dasm_put(Dst, 13672, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13694, -BCBIAS_J*4); dasm_put(Dst, 13686, -BCBIAS_J*4);
} }
dasm_put(Dst, 9867); dasm_put(Dst, 9867);
break; break;
case BC_LOOP: case BC_LOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13465, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2126,12 +2126,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_JLOOP: case BC_JLOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13710, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); dasm_put(Dst, 13702, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
#endif #endif
break; break;
case BC_JMP: case BC_JMP:
dasm_put(Dst, 13751, -BCBIAS_J*4); dasm_put(Dst, 13743, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2145,7 +2145,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF: case BC_FUNCF:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13777, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13769, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2155,13 +2155,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IFUNCF: case BC_IFUNCF:
dasm_put(Dst, 13798, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 13790, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 13829, BC_JLOOP); dasm_put(Dst, 13821, BC_JLOOP);
} else { } else {
dasm_put(Dst, 9565); dasm_put(Dst, 9565);
} }
dasm_put(Dst, 13838, LJ_TNIL); dasm_put(Dst, 13830, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2172,30 +2172,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */ break; /* NYI: compiled vararg functions. */
case BC_IFUNCV: case BC_IFUNCV:
dasm_put(Dst, 13860, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 13852, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 13829, BC_JLOOP); dasm_put(Dst, 13821, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13957, -4+PC2PROTO(k)); dasm_put(Dst, 13949, -4+PC2PROTO(k));
} }
dasm_put(Dst, 13982, LJ_TNIL); dasm_put(Dst, 13974, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 14004, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 13996, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14034); dasm_put(Dst, 14026);
} else { } else {
dasm_put(Dst, 14038); dasm_put(Dst, 14030);
} }
dasm_put(Dst, 14046, DISPATCH_GL(vmstate), ~LJ_VMST_C); dasm_put(Dst, 14038, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14056); dasm_put(Dst, 14048);
} else { } else {
dasm_put(Dst, 14061, DISPATCH_GL(wrapf)); dasm_put(Dst, 14053, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 14067, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 14059, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2223,7 +2223,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 14093); dasm_put(Dst, 14085);
for (op = 0; op < BC__MAX; op++) for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse); build_ins(ctx, (BCOp)op, op, cmov, sse);

View File

@ -12,7 +12,7 @@
#define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1 #define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2 #define DASM_MAXSECTION 2
static const unsigned char build_actionlist[14042] = { static const unsigned char build_actionlist[14034] = {
254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,72, 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,72,
141,76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68, 141,76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,
36,84,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237, 36,84,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,
@ -640,62 +640,61 @@ static const unsigned char build_actionlist[14042] = {
252,236,137,41,137,65,4,139,105,252,240,139,65,252,244,137,105,8,137,65,12, 252,236,137,41,137,65,4,139,105,252,240,139,65,252,244,137,105,8,137,65,12,
139,105,224,139,65,228,137,105,252,248,137,65,252,252,129,252,248,239,184, 139,105,224,139,65,228,137,105,252,248,137,65,252,252,129,252,248,239,184,
237,15,133,244,28,137,202,137,114,252,252,139,181,233,139,14,15,182,252,233, 237,15,133,244,28,137,202,137,114,252,252,139,181,233,139,14,15,182,252,233,
15,182,205,131,198,4,252,255,36,252,235,255,15,182,252,236,139,66,252,248, 15,182,205,131,198,4,252,255,36,252,235,255,15,182,252,236,15,182,192,137,
141,12,202,139,128,233,15,182,128,233,137,124,36,80,141,188,253,194,233,43, 124,36,80,141,188,253,194,233,141,12,202,43,122,252,252,133,252,237,15,132,
122,252,252,133,252,237,15,132,244,251,141,108,252,233,252,248,57,215,15, 244,251,141,108,252,233,252,248,57,215,15,131,244,248,248,1,139,71,252,248,
131,244,248,248,1,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4, 137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,
131,193,8,57,252,233,15,131,244,249,57,215,15,130,244,1,248,2,199,65,4,237, 57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,2,
131,193,8,57,252,233,15,130,244,2,248,3,139,124,36,80,139,6,15,182,204,15, 248,3,139,124,36,80,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,
182,232,131,198,4,193,232,16,252,255,36,252,235,248,5,199,68,36,84,1,0,0, 255,36,252,235,248,5,199,68,36,84,1,0,0,0,137,208,41,252,248,15,134,244,3,
0,137,208,41,252,248,15,134,244,3,255,137,197,193,252,237,3,131,197,1,137, 137,197,193,252,237,3,131,197,1,137,108,36,84,139,108,36,96,1,200,59,133,
108,36,84,139,108,36,96,1,200,59,133,233,15,135,244,253,248,6,139,71,252, 233,15,135,244,253,248,6,255,139,71,252,248,137,1,139,71,252,252,131,199,
248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,215,15,130,244,6, 8,137,65,4,131,193,8,57,215,15,130,244,6,252,233,244,3,248,7,137,149,233,
252,233,244,3,248,7,137,149,233,137,141,233,137,116,36,100,41,215,139,84, 137,141,233,137,116,36,100,41,215,139,84,36,84,131,252,234,1,137,252,233,
36,84,131,252,234,1,137,252,233,232,251,1,0,139,149,233,139,141,233,1,215, 232,251,1,0,139,149,233,139,141,233,1,215,252,233,244,6,255,193,225,3,255,
252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68,36,84,252,247, 248,1,139,114,252,252,137,68,36,84,252,247,198,237,15,133,244,253,255,248,
198,237,15,133,244,253,255,248,13,137,215,131,232,1,15,132,244,249,248,2, 13,137,215,131,232,1,15,132,244,249,248,2,139,44,15,137,111,252,248,139,108,
139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131,199,8,131,232, 15,4,137,111,252,252,131,199,8,131,232,1,15,133,244,2,248,3,139,68,36,84,
1,15,133,244,2,248,3,139,68,36,84,15,182,110,252,255,248,5,57,197,15,135, 15,182,110,252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,106,252,
244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,248, 252,139,44,10,137,106,252,248,255,248,5,56,70,252,255,15,135,244,252,255,
5,56,70,252,255,15,135,244,252,255,15,182,78,252,253,72,252,247,209,141,20, 15,182,78,252,253,72,252,247,209,141,20,202,139,122,252,248,139,191,233,139,
202,139,122,252,248,139,191,233,139,191,233,139,6,15,182,204,15,182,232,131, 191,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,
198,4,193,232,16,252,255,36,252,235,248,6,255,199,71,252,252,237,131,199, 248,6,255,199,71,252,252,237,131,199,8,255,199,68,194,252,244,237,255,131,
8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,5,248,7,141,174,233, 192,1,252,233,244,5,248,7,141,174,233,252,247,197,237,15,133,244,14,41,252,
252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,255,137,252,245,209, 234,255,1,252,233,255,137,252,245,209,252,237,129,229,239,102,131,172,253,
252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,140,255,141,12,202, 43,233,1,15,132,244,140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,
255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,15,135,244,53,255, 129,121,253,12,239,15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,
139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,15,16,1,252,242, 244,53,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,
15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244, 242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,
249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221, 248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,
65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244,247,255, 24,133,252,237,15,136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,
221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,70,252,254,255,15,131, 1,255,15,183,70,252,254,255,15,131,244,248,141,180,253,134,233,255,141,180,
244,248,141,180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15, 253,134,233,15,183,70,252,254,15,131,245,255,15,130,244,248,141,180,253,134,
131,245,255,15,130,244,248,141,180,253,134,233,255,248,3,102,15,46,193,252, 233,255,248,3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,
233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,132,244,247,255,137, 253,239,15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,
105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253,134,233,139, 245,255,141,180,253,134,233,139,1,137,105,252,252,137,65,252,248,255,139,
1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,72,139,128,233, 139,233,139,4,129,72,139,128,233,139,108,36,96,137,147,233,137,171,233,76,
139,108,36,96,137,147,233,137,171,233,76,137,100,36,80,76,137,108,36,32,76, 137,100,36,80,76,137,108,36,32,76,137,116,36,24,76,137,124,36,16,72,137,225,
137,116,36,24,76,137,124,36,16,72,137,225,72,129,252,236,239,102,15,127,49, 72,129,252,236,239,102,15,127,49,102,15,127,185,233,102,68,15,127,129,233,
102,15,127,185,233,102,68,15,127,129,233,102,68,15,127,137,233,102,68,15, 102,68,15,127,137,233,102,68,15,127,145,233,102,68,15,127,153,233,102,68,
127,145,233,102,68,15,127,153,233,102,68,15,127,161,233,102,68,15,127,169, 15,127,161,233,102,68,15,127,169,233,102,68,15,127,177,233,102,68,15,127,
233,102,68,15,127,177,233,102,68,15,127,185,233,252,255,224,255,141,180,253, 185,233,252,255,224,255,141,180,253,134,233,139,6,15,182,204,15,182,232,131,
134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235, 198,4,193,232,16,252,255,36,252,235,255,137,252,245,209,252,237,129,229,239,
255,137,252,245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244, 102,131,172,253,43,233,1,15,132,244,142,255,139,190,233,139,108,36,96,141,
142,255,139,190,233,139,108,36,96,141,12,202,59,141,233,15,135,244,23,15, 12,202,59,141,233,15,135,244,23,15,182,142,233,57,200,15,134,244,249,248,
182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252,254,252,233,245, 2,255,15,183,70,252,254,252,233,245,255,248,3,199,68,194,252,252,237,131,
255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233,244, 192,1,57,200,15,134,244,3,252,233,244,2,255,141,44,197,237,141,4,194,139,
2,255,141,44,197,237,141,4,194,139,122,252,248,137,104,252,252,137,120,252, 122,252,248,137,104,252,252,137,120,252,248,139,108,36,96,141,12,200,59,141,
248,139,108,36,96,141,12,200,59,141,233,15,135,244,22,137,209,137,194,15, 233,15,135,244,22,137,209,137,194,15,182,174,233,133,252,237,15,132,244,248,
182,174,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209,15,131,244, 248,1,131,193,8,57,209,15,131,244,249,139,121,252,248,137,56,139,121,252,
249,139,121,252,248,137,56,139,121,252,252,137,120,4,131,192,8,199,65,252, 252,137,120,4,131,192,8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,
252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233,139,6,15,182,204, 2,255,139,190,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
15,182,232,131,198,4,193,232,16,252,255,36,252,235,255,248,3,199,64,4,237, 36,252,235,255,248,3,199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,
131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106,252,248,72, 233,244,2,255,139,106,252,248,72,139,189,233,139,108,36,96,141,68,194,252,
139,189,233,139,108,36,96,141,68,194,252,248,137,149,233,141,136,233,59,141, 248,137,149,233,141,136,233,59,141,233,137,133,233,255,137,252,233,255,72,
233,137,133,233,255,137,252,233,255,72,137,252,250,137,252,233,255,15,135, 137,252,250,137,252,233,255,15,135,244,21,199,131,233,237,255,252,255,215,
244,21,199,131,233,237,255,252,255,215,255,252,255,147,233,255,199,131,233, 255,252,255,147,233,255,199,131,233,237,139,149,233,141,12,194,252,247,217,
237,139,149,233,141,12,194,252,247,217,3,141,233,139,114,252,252,252,233, 3,141,233,139,114,252,252,252,233,244,12,255,254,0
244,12,255,254,0
}; };
enum { enum {
@ -1992,8 +1991,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 12926, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 12926, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
dasm_put(Dst, 13071, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 13091, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
@ -2004,30 +2003,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_RET: case BC_RET0: case BC_RET1: case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13170); dasm_put(Dst, 13162);
} }
dasm_put(Dst, 13174, FRAME_TYPE); dasm_put(Dst, 13166, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 13193); dasm_put(Dst, 13185);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 13251); dasm_put(Dst, 13243);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 13267); dasm_put(Dst, 13259);
default: default:
break; break;
} }
dasm_put(Dst, 13278, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 13270, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 13322, LJ_TNIL); dasm_put(Dst, 13314, LJ_TNIL);
} else { } else {
dasm_put(Dst, 13331, LJ_TNIL); dasm_put(Dst, 13323, LJ_TNIL);
} }
dasm_put(Dst, 13338, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 13330, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13362); dasm_put(Dst, 13354);
} }
dasm_put(Dst, 4573); dasm_put(Dst, 4573);
break; break;
@ -2037,7 +2036,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL: case BC_FORL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13358, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2049,57 +2048,57 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI: case BC_FORI:
case BC_IFORL: case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL); vk = (op == BC_IFORL || op == BC_JFORL);
dasm_put(Dst, 13387); dasm_put(Dst, 13379);
if (!vk) { if (!vk) {
dasm_put(Dst, 13391, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 13383, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 13410); dasm_put(Dst, 13402);
if (!vk) { if (!vk) {
dasm_put(Dst, 13414, LJ_TISNUM); dasm_put(Dst, 13406, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 13423); dasm_put(Dst, 13415);
if (vk) { if (vk) {
dasm_put(Dst, 13435); dasm_put(Dst, 13427);
} else { } else {
dasm_put(Dst, 13454); dasm_put(Dst, 13446);
} }
dasm_put(Dst, 13459); dasm_put(Dst, 13451);
} else { } else {
dasm_put(Dst, 13472); dasm_put(Dst, 13464);
if (vk) { if (vk) {
dasm_put(Dst, 13478); dasm_put(Dst, 13470);
} else { } else {
dasm_put(Dst, 13486);
}
dasm_put(Dst, 13494); dasm_put(Dst, 13494);
}
dasm_put(Dst, 13502);
if (cmov) { if (cmov) {
dasm_put(Dst, 9536); dasm_put(Dst, 9536);
} else { } else {
dasm_put(Dst, 9542); dasm_put(Dst, 9542);
} }
if (!cmov) { if (!cmov) {
dasm_put(Dst, 13507); dasm_put(Dst, 13499);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 13513, -BCBIAS_J*4); dasm_put(Dst, 13505, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 13523, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 13515, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 13537, -BCBIAS_J*4); dasm_put(Dst, 13529, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 13533, BC_JLOOP); dasm_put(Dst, 13525, BC_JLOOP);
} }
dasm_put(Dst, 9571); dasm_put(Dst, 9571);
if (sse) { if (sse) {
dasm_put(Dst, 13547); dasm_put(Dst, 13539);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13358, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2108,18 +2107,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IITERL: case BC_IITERL:
dasm_put(Dst, 13558, LJ_TNIL); dasm_put(Dst, 13550, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 13573, BC_JLOOP); dasm_put(Dst, 13565, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13587, -BCBIAS_J*4); dasm_put(Dst, 13579, -BCBIAS_J*4);
} }
dasm_put(Dst, 9871); dasm_put(Dst, 9871);
break; break;
case BC_LOOP: case BC_LOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13358, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2129,12 +2128,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_JLOOP: case BC_JLOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13603, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), 9*16+4*8, -1*16, -2*16, -3*16, -4*16, -5*16, -6*16, -7*16, -8*16, -9*16); dasm_put(Dst, 13595, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), 9*16+4*8, -1*16, -2*16, -3*16, -4*16, -5*16, -6*16, -7*16, -8*16, -9*16);
#endif #endif
break; break;
case BC_JMP: case BC_JMP:
dasm_put(Dst, 13712, -BCBIAS_J*4); dasm_put(Dst, 13704, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2148,7 +2147,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF: case BC_FUNCF:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13737, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13729, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2158,13 +2157,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IFUNCF: case BC_IFUNCF:
dasm_put(Dst, 13758, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 13750, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 13788, BC_JLOOP); dasm_put(Dst, 13780, BC_JLOOP);
} else { } else {
dasm_put(Dst, 9573); dasm_put(Dst, 9573);
} }
dasm_put(Dst, 13797, LJ_TNIL); dasm_put(Dst, 13789, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2175,30 +2174,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */ break; /* NYI: compiled vararg functions. */
case BC_IFUNCV: case BC_IFUNCV:
dasm_put(Dst, 13819, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 13811, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 13788, BC_JLOOP); dasm_put(Dst, 13780, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13910, -4+PC2PROTO(k)); dasm_put(Dst, 13902, -4+PC2PROTO(k));
} }
dasm_put(Dst, 13933, LJ_TNIL); dasm_put(Dst, 13925, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 13955, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 13947, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 13985); dasm_put(Dst, 13977);
} else { } else {
dasm_put(Dst, 13989); dasm_put(Dst, 13981);
} }
dasm_put(Dst, 13997, DISPATCH_GL(vmstate), ~LJ_VMST_C); dasm_put(Dst, 13989, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14006); dasm_put(Dst, 13998);
} else { } else {
dasm_put(Dst, 14010, DISPATCH_GL(wrapf)); dasm_put(Dst, 14002, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 14015, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 14007, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2226,7 +2225,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 14040); dasm_put(Dst, 14032);
for (op = 0; op < BC__MAX; op++) for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse); build_ins(ctx, (BCOp)op, op, cmov, sse);

View File

@ -4442,13 +4442,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_VARG: case BC_VARG:
| ins_AB_ // RA = base, RB = nresults+1, (RC = 1) | ins_ABC // RA = base, RB = nresults+1, RC = numparams
| mov LFUNC:RC, [BASE-8]
| lea RA, [BASE+RA*8]
| mov RC, LFUNC:RC->pc
| movzx RC, byte [RC+PC2PROTO(numparams)]
| mov TMP1, KBASE // Need one more free register. | mov TMP1, KBASE // Need one more free register.
| lea KBASE, [BASE+RC*8+(8+FRAME_VARG)] | lea KBASE, [BASE+RC*8+(8+FRAME_VARG)]
| lea RA, [BASE+RA*8]
| sub KBASE, [BASE-4] | sub KBASE, [BASE-4]
| // Note: KBASE may now be even _above_ BASE if nargs was < numparams. | // Note: KBASE may now be even _above_ BASE if nargs was < numparams.
| test RB, RB | test RB, RB

View File

@ -12,7 +12,7 @@
#define DASM_SECTION_CODE_OP 0 #define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1 #define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2 #define DASM_MAXSECTION 2
static const unsigned char build_actionlist[15235] = { static const unsigned char build_actionlist[15227] = {
254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141, 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141,
76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36, 76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,
20,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,15, 20,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,15,
@ -698,57 +698,56 @@ static const unsigned char build_actionlist[15235] = {
139,105,252,240,139,65,252,244,137,105,8,137,65,12,139,105,224,139,65,228, 139,105,252,240,139,65,252,244,137,105,8,137,65,12,139,105,224,139,65,228,
137,105,252,248,137,65,252,252,129,252,248,239,184,237,15,133,244,28,137, 137,105,252,248,137,65,252,252,129,252,248,239,184,237,15,133,244,28,137,
202,137,114,252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198, 202,137,114,252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,
4,252,255,36,171,255,15,182,252,236,139,66,252,248,141,12,202,139,128,233, 4,252,255,36,171,255,15,182,252,236,15,182,192,137,124,36,16,141,188,253,
15,182,128,233,137,124,36,16,141,188,253,194,233,43,122,252,252,133,252,237, 194,233,141,12,202,43,122,252,252,133,252,237,15,132,244,251,141,108,252,
15,132,244,251,141,108,252,233,252,248,57,215,15,131,244,248,248,1,139,71, 233,252,248,57,215,15,131,244,248,248,1,139,71,252,248,137,1,139,71,252,252,
252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,252,233,15,131, 131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,57,215,15,130,244,
244,249,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130, 1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,2,248,3,139,124,36,16,
244,2,248,3,139,124,36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,5,199,
252,255,36,171,248,5,199,68,36,20,1,0,0,0,137,208,41,252,248,15,134,244,3, 68,36,20,1,0,0,0,137,208,41,252,248,15,134,244,3,137,197,193,252,237,3,131,
255,137,197,193,252,237,3,131,197,1,137,108,36,20,139,108,36,48,1,200,59, 197,1,137,108,36,20,139,108,36,48,1,200,59,133,233,15,135,244,253,248,6,255,
133,233,15,135,244,253,248,6,139,71,252,248,137,1,139,71,252,252,131,199, 139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,215,15,
8,137,65,4,131,193,8,57,215,15,130,244,6,252,233,244,3,248,7,137,149,233, 130,244,6,252,233,244,3,248,7,137,149,233,137,141,233,137,116,36,24,41,215,
137,141,233,137,116,36,24,41,215,139,84,36,20,131,252,234,1,137,252,233,232, 139,84,36,20,131,252,234,1,137,252,233,232,251,1,0,139,149,233,139,141,233,
251,1,0,139,149,233,139,141,233,1,215,252,233,244,6,255,193,225,3,255,248, 1,215,252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68,36,20,
1,139,114,252,252,137,68,36,20,252,247,198,237,15,133,244,253,255,248,13, 252,247,198,237,15,133,244,253,255,248,13,137,215,131,232,1,15,132,244,249,
137,215,131,232,1,15,132,244,249,248,2,139,44,15,137,111,252,248,139,108, 248,2,139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131,199,8,131,
15,4,137,111,252,252,131,199,8,131,232,1,15,133,244,2,248,3,139,68,36,20, 232,1,15,133,244,2,248,3,139,68,36,20,15,182,110,252,255,248,5,57,197,15,
15,182,110,252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,106,252, 135,244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,
252,139,44,10,137,106,252,248,255,248,5,56,70,252,255,15,135,244,252,255, 248,5,56,70,252,255,15,135,244,252,255,15,182,78,252,253,252,247,209,141,
15,182,78,252,253,252,247,209,141,20,202,139,122,252,248,139,191,233,139, 20,202,139,122,252,248,139,191,233,139,191,233,139,6,15,182,204,15,182,232,
191,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248, 131,198,4,193,232,16,252,255,36,171,248,6,255,199,71,252,252,237,131,199,
6,255,199,71,252,252,237,131,199,8,255,199,68,194,252,244,237,255,131,192, 8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,5,248,7,141,174,233,
1,252,233,244,5,248,7,141,174,233,252,247,197,237,15,133,244,14,41,252,234, 252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,255,137,252,245,209,
255,1,252,233,255,137,252,245,209,252,237,129,229,239,102,131,172,253,43, 252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,140,255,141,12,202,
233,1,15,132,244,140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,129, 255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,15,135,244,53,255,
121,253,12,239,15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,244, 139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,15,16,1,252,242,
53,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242, 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,
15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,248, 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,
1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133, 65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244,247,255,
252,237,15,136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,1,255, 221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,70,252,254,255,15,131,
15,183,70,252,254,255,15,131,244,248,141,180,253,134,233,255,141,180,253, 244,248,141,180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,
134,233,15,183,70,252,254,15,131,245,255,15,130,244,248,141,180,253,134,233, 131,245,255,15,130,244,248,141,180,253,134,233,255,248,3,102,15,46,193,252,
255,248,3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253, 233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,132,244,247,255,137,
239,15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245, 105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253,134,233,139,
255,141,180,253,134,233,139,1,137,105,252,252,137,65,252,248,255,139,139, 1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,139,128,233,139,
233,139,4,129,139,128,233,139,108,36,48,137,147,233,137,171,233,252,255,224, 108,36,48,137,147,233,137,171,233,252,255,224,255,141,180,253,134,233,139,
255,141,180,253,134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,137,252,245,
252,255,36,171,255,137,252,245,209,252,237,129,229,239,102,131,172,253,43, 209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,142,255,139,190,
233,1,15,132,244,142,255,139,190,233,139,108,36,48,141,12,202,59,141,233, 233,139,108,36,48,141,12,202,59,141,233,15,135,244,23,15,182,142,233,57,200,
15,135,244,23,15,182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252, 15,134,244,249,248,2,255,15,183,70,252,254,252,233,245,255,248,3,199,68,194,
254,252,233,245,255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134, 252,252,237,131,192,1,57,200,15,134,244,3,252,233,244,2,255,141,44,197,237,
244,3,252,233,244,2,255,141,44,197,237,141,4,194,139,122,252,248,137,104, 141,4,194,139,122,252,248,137,104,252,252,137,120,252,248,139,108,36,48,141,
252,252,137,120,252,248,139,108,36,48,141,12,200,59,141,233,15,135,244,22, 12,200,59,141,233,15,135,244,22,137,209,137,194,15,182,174,233,133,252,237,
137,209,137,194,15,182,174,233,133,252,237,15,132,244,248,248,1,131,193,8, 15,132,244,248,248,1,131,193,8,57,209,15,131,244,249,139,121,252,248,137,
57,209,15,131,244,249,139,121,252,248,137,56,139,121,252,252,137,120,4,131, 56,139,121,252,252,137,120,4,131,192,8,199,65,252,252,237,131,252,237,1,15,
192,8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233, 133,244,1,248,2,255,139,190,233,139,6,15,182,204,15,182,232,131,198,4,193,
139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,248,3, 232,16,252,255,36,171,255,248,3,199,64,4,237,131,192,8,131,252,237,1,15,133,
199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106, 244,3,252,233,244,2,255,139,106,252,248,139,189,233,139,108,36,48,141,68,
252,248,139,189,233,139,108,36,48,141,68,194,252,248,137,149,233,141,136, 194,252,248,137,149,233,141,136,233,59,141,233,137,133,233,255,137,44,36,
233,59,141,233,137,133,233,255,137,44,36,255,137,124,36,4,137,44,36,255,15, 255,137,124,36,4,137,44,36,255,15,135,244,21,199,131,233,237,255,252,255,
135,244,21,199,131,233,237,255,252,255,215,255,252,255,147,233,255,199,131, 215,255,252,255,147,233,255,199,131,233,237,139,149,233,141,12,194,252,247,
233,237,139,149,233,141,12,194,252,247,217,3,141,233,139,114,252,252,252, 217,3,141,233,139,114,252,252,252,233,244,12,255,254,0
233,244,12,255,254,0
}; };
enum { enum {
@ -2116,8 +2115,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 14211, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 14211, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
dasm_put(Dst, 14355, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 14375, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
@ -2128,30 +2127,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_RET: case BC_RET0: case BC_RET1: case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 14454); dasm_put(Dst, 14446);
} }
dasm_put(Dst, 14458, FRAME_TYPE); dasm_put(Dst, 14450, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 14477); dasm_put(Dst, 14469);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 14535); dasm_put(Dst, 14527);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 14551); dasm_put(Dst, 14543);
default: default:
break; break;
} }
dasm_put(Dst, 14562, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 14554, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 14604, LJ_TNIL); dasm_put(Dst, 14596, LJ_TNIL);
} else { } else {
dasm_put(Dst, 14613, LJ_TNIL); dasm_put(Dst, 14605, LJ_TNIL);
} }
dasm_put(Dst, 14620, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 14612, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 14644); dasm_put(Dst, 14636);
} }
dasm_put(Dst, 4683); dasm_put(Dst, 4683);
break; break;
@ -2161,7 +2160,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL: case BC_FORL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14640, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2173,57 +2172,57 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI: case BC_FORI:
case BC_IFORL: case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL); vk = (op == BC_IFORL || op == BC_JFORL);
dasm_put(Dst, 14669); dasm_put(Dst, 14661);
if (!vk) { if (!vk) {
dasm_put(Dst, 14673, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 14665, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 14692); dasm_put(Dst, 14684);
if (!vk) { if (!vk) {
dasm_put(Dst, 14696, LJ_TISNUM); dasm_put(Dst, 14688, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 14705); dasm_put(Dst, 14697);
if (vk) { if (vk) {
dasm_put(Dst, 14717); dasm_put(Dst, 14709);
} else { } else {
dasm_put(Dst, 14736); dasm_put(Dst, 14728);
} }
dasm_put(Dst, 14741); dasm_put(Dst, 14733);
} else { } else {
dasm_put(Dst, 14754); dasm_put(Dst, 14746);
if (vk) { if (vk) {
dasm_put(Dst, 14760); dasm_put(Dst, 14752);
} else { } else {
dasm_put(Dst, 14768);
}
dasm_put(Dst, 14776); dasm_put(Dst, 14776);
}
dasm_put(Dst, 14784);
if (cmov) { if (cmov) {
dasm_put(Dst, 10812); dasm_put(Dst, 10812);
} else { } else {
dasm_put(Dst, 10818); dasm_put(Dst, 10818);
} }
if (!cmov) { if (!cmov) {
dasm_put(Dst, 14789); dasm_put(Dst, 14781);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 14795, -BCBIAS_J*4); dasm_put(Dst, 14787, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 14805, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 14797, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 14819, -BCBIAS_J*4); dasm_put(Dst, 14811, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 14815, BC_JLOOP); dasm_put(Dst, 14807, BC_JLOOP);
} }
dasm_put(Dst, 10847); dasm_put(Dst, 10847);
if (sse) { if (sse) {
dasm_put(Dst, 14829); dasm_put(Dst, 14821);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14640, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2232,18 +2231,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IITERL: case BC_IITERL:
dasm_put(Dst, 14840, LJ_TNIL); dasm_put(Dst, 14832, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 14855, BC_JLOOP); dasm_put(Dst, 14847, BC_JLOOP);
} else { } else {
dasm_put(Dst, 14869, -BCBIAS_J*4); dasm_put(Dst, 14861, -BCBIAS_J*4);
} }
dasm_put(Dst, 11144); dasm_put(Dst, 11144);
break; break;
case BC_LOOP: case BC_LOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14640, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2253,12 +2252,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_JLOOP: case BC_JLOOP:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14885, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); dasm_put(Dst, 14877, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
#endif #endif
break; break;
case BC_JMP: case BC_JMP:
dasm_put(Dst, 14908, -BCBIAS_J*4); dasm_put(Dst, 14900, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2272,7 +2271,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF: case BC_FUNCF:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14932, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14924, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2282,13 +2281,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
#endif #endif
case BC_IFUNCF: case BC_IFUNCF:
dasm_put(Dst, 14953, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 14945, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 14983, BC_JLOOP); dasm_put(Dst, 14975, BC_JLOOP);
} else { } else {
dasm_put(Dst, 10849); dasm_put(Dst, 10849);
} }
dasm_put(Dst, 14992, LJ_TNIL); dasm_put(Dst, 14984, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2299,30 +2298,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */ break; /* NYI: compiled vararg functions. */
case BC_IFUNCV: case BC_IFUNCV:
dasm_put(Dst, 15014, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 15006, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 14983, BC_JLOOP); dasm_put(Dst, 14975, BC_JLOOP);
} else { } else {
dasm_put(Dst, 15105, -4+PC2PROTO(k)); dasm_put(Dst, 15097, -4+PC2PROTO(k));
} }
dasm_put(Dst, 15127, LJ_TNIL); dasm_put(Dst, 15119, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 15149, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 15141, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 15178); dasm_put(Dst, 15170);
} else { } else {
dasm_put(Dst, 15182); dasm_put(Dst, 15174);
} }
dasm_put(Dst, 15190, DISPATCH_GL(vmstate), ~LJ_VMST_C); dasm_put(Dst, 15182, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 15199); dasm_put(Dst, 15191);
} else { } else {
dasm_put(Dst, 15203, DISPATCH_GL(wrapf)); dasm_put(Dst, 15195, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 15208, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 15200, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2350,7 +2349,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 15233); dasm_put(Dst, 15225);
for (op = 0; op < BC__MAX; op++) for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse); build_ins(ctx, (BCOp)op, op, cmov, sse);

View File

@ -274,7 +274,7 @@ static MSize gc_traverse_frames(global_State *g, lua_State *th)
TValue *ftop = frame; TValue *ftop = frame;
if (isluafunc(fn)) ftop += funcproto(fn)->framesize; if (isluafunc(fn)) ftop += funcproto(fn)->framesize;
if (ftop > top) top = ftop; if (ftop > top) top = ftop;
gc_markobj(g, frame_gc(frame)); /* Need to mark hidden function (or L). */ gc_markobj(g, fn); /* Need to mark hidden function (or L). */
} }
top++; /* Correct bias of -1 (frame == base-1). */ top++; /* Correct bias of -1 (frame == base-1). */
if (top > tvref(th->maxstack)) top = tvref(th->maxstack); if (top > tvref(th->maxstack)) top = tvref(th->maxstack);

View File

@ -116,7 +116,7 @@ typedef struct FuncState {
BCPos bclim; /* Limit of bytecode stack. */ BCPos bclim; /* Limit of bytecode stack. */
MSize vbase; /* Base of variable stack for this function. */ MSize vbase; /* Base of variable stack for this function. */
uint8_t flags; /* Prototype flags. */ uint8_t flags; /* Prototype flags. */
uint8_t numparams; /* Number of active local variables. */ uint8_t numparams; /* Number of parameters. */
uint8_t framesize; /* Fixed frame size. */ uint8_t framesize; /* Fixed frame size. */
uint8_t nuv; /* Number of upvalues */ uint8_t nuv; /* Number of upvalues */
VarIndex varmap[LJ_MAX_LOCVAR]; /* Map from register to variable idx. */ VarIndex varmap[LJ_MAX_LOCVAR]; /* Map from register to variable idx. */
@ -1397,10 +1397,8 @@ static BCReg parse_params(LexState *ls, int needself)
FuncState *fs = ls->fs; FuncState *fs = ls->fs;
BCReg nparams = 0; BCReg nparams = 0;
lex_check(ls, '('); lex_check(ls, '(');
if (needself) { if (needself)
var_new_lit(ls, 0, "self"); var_new_lit(ls, nparams++, "self");
var_add(ls, 1);
}
if (ls->token != ')') { if (ls->token != ')') {
do { do {
if (ls->token == TK_name) { if (ls->token == TK_name) {
@ -1415,9 +1413,10 @@ static BCReg parse_params(LexState *ls, int needself)
} while (lex_opt(ls, ',')); } while (lex_opt(ls, ','));
} }
var_add(ls, nparams); var_add(ls, nparams);
bcreg_reserve(fs, fs->nactvar); lua_assert(fs->nactvar == nparams);
bcreg_reserve(fs, nparams);
lex_check(ls, ')'); lex_check(ls, ')');
return fs->nactvar; return nparams;
} }
/* Forward declaration. */ /* Forward declaration. */
@ -1577,7 +1576,7 @@ static void expr_simple(LexState *ls, ExpDesc *v)
checkcond(ls, fs->flags & PROTO_IS_VARARG, LJ_ERR_XDOTS); checkcond(ls, fs->flags & PROTO_IS_VARARG, LJ_ERR_XDOTS);
bcreg_reserve(fs, 1); bcreg_reserve(fs, 1);
base = fs->freereg-1; base = fs->freereg-1;
expr_init(v, VCALL, bcemit_ABC(fs, BC_VARG, base, 2, 1)); expr_init(v, VCALL, bcemit_ABC(fs, BC_VARG, base, 2, fs->numparams));
v->u.s.aux = base; v->u.s.aux = base;
break; break;
} }