Turn some lua_State fields into 32 bit pointers.

lua_State now fits into one cache line on x64.
This commit is contained in:
Mike Pall 2010-09-09 12:28:17 +02:00
parent fd63b05253
commit 96957a4551
13 changed files with 474 additions and 484 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[14100] = { static const unsigned char build_actionlist[14095] = {
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,
@ -616,84 +616,84 @@ static const unsigned char build_actionlist[14100] = {
15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,3,131,189,233,0, 15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,3,131,189,233,0,
15,132,244,1,255,139,141,233,252,246,129,233,235,15,132,244,38,15,182,75, 15,132,244,1,255,139,141,233,252,246,129,233,235,15,132,244,38,15,182,75,
252,253,252,233,244,1,248,7,128,165,233,235,65,139,142,233,65,137,174,233, 252,253,252,233,244,1,248,7,128,165,233,235,65,139,142,233,65,137,174,233,
137,141,233,15,182,75,252,253,252,233,244,2,255,68,137,60,36,255,252,242, 137,141,233,15,182,75,252,253,252,233,244,2,255,68,137,60,36,69,139,60,199,
69,15,45,60,199,255,248,1,141,12,202,139,105,252,248,252,246,133,233,235, 248,1,141,12,202,139,105,252,248,252,246,133,233,235,15,133,244,253,248,2,
15,133,244,253,248,2,139,68,36,4,131,232,1,15,132,244,250,68,1,252,248,59, 139,68,36,4,131,232,1,15,132,244,250,68,1,252,248,59,133,233,15,131,244,251,
133,233,15,131,244,251,68,41,252,248,65,193,231,3,68,3,189,233,248,3,139, 68,41,252,248,65,193,231,3,68,3,189,233,248,3,139,41,65,137,47,139,105,4,
41,65,137,47,139,105,4,131,193,8,65,137,111,4,65,131,199,8,131,232,1,15,133, 131,193,8,65,137,111,4,65,131,199,8,131,232,1,15,133,244,3,248,4,68,139,60,
244,3,248,4,68,139,60,36,139,3,15,182,204,15,182,232,131,195,4,193,232,16, 36,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,
65,252,255,36,252,238,248,5,139,124,36,24,137,151,233,137,252,238,137,194, 248,5,139,124,36,24,137,151,233,137,252,238,137,194,137,252,253,137,92,36,
137,252,253,137,92,36,28,232,251,1,33,139,149,233,15,182,75,252,253,252,233, 28,232,251,1,33,139,149,233,15,182,75,252,253,252,233,244,1,248,7,255,128,
244,1,248,7,255,128,165,233,235,65,139,134,233,65,137,174,233,137,133,233, 165,233,235,65,139,134,233,65,137,174,233,137,133,233,252,233,244,2,255,3,
252,233,244,2,255,3,68,36,4,255,129,124,253,202,4,239,139,44,202,15,133,244, 68,36,4,255,129,124,253,202,4,239,139,44,202,15,133,244,51,141,84,202,8,137,
51,141,84,202,8,137,90,252,252,139,157,233,139,11,15,182,252,233,15,182,205, 90,252,252,139,157,233,139,11,15,182,252,233,15,182,205,131,195,4,65,252,
131,195,4,65,252,255,36,252,238,255,141,76,202,8,65,137,215,139,105,252,248, 255,36,252,238,255,141,76,202,8,65,137,215,139,105,252,248,129,121,253,252,
129,121,253,252,252,239,15,133,244,28,248,52,139,90,252,252,252,247,195,237, 252,239,15,133,244,28,248,52,139,90,252,252,252,247,195,237,15,133,244,253,
15,133,244,253,248,1,137,106,252,248,137,68,36,4,131,232,1,15,132,244,249, 248,1,137,106,252,248,137,68,36,4,131,232,1,15,132,244,249,248,2,139,41,65,
248,2,139,41,65,137,47,139,105,4,65,137,111,4,65,131,199,8,131,193,8,131, 137,47,139,105,4,65,137,111,4,65,131,199,8,131,193,8,131,232,1,15,133,244,
232,1,15,133,244,2,139,106,252,248,248,3,139,68,36,4,128,189,233,1,15,135, 2,139,106,252,248,248,3,139,68,36,4,128,189,233,1,15,135,244,251,248,4,139,
244,251,248,4,139,157,233,139,11,15,182,252,233,15,182,205,131,195,4,65,252,
255,36,252,238,248,5,255,252,247,195,237,15,133,244,4,15,182,75,252,253,72,
252,247,209,141,12,202,68,139,121,252,248,69,139,191,233,69,139,191,233,252,
233,244,4,248,7,129,252,235,239,252,247,195,237,15,133,244,254,41,218,65,
137,215,139,90,252,252,252,233,244,1,248,8,129,195,239,252,233,244,1,255,
141,76,202,8,139,105,232,139,65,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,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, 157,233,139,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, 248,5,255,252,247,195,237,15,133,244,4,15,182,75,252,253,72,252,247,209,141,
137,60,36,68,141,188,253,194,233,68,43,122,252,252,133,252,237,15,132,244, 12,202,68,139,121,252,248,69,139,191,233,69,139,191,233,252,233,244,4,248,
251,141,108,252,233,252,248,65,57,215,15,131,244,248,248,1,65,139,71,252, 7,129,252,235,239,252,247,195,237,15,133,244,254,41,218,65,137,215,139,90,
248,137,1,65,139,71,252,252,65,131,199,8,137,65,4,131,193,8,57,252,233,15, 252,252,252,233,244,1,248,8,129,195,239,252,233,244,1,255,141,76,202,8,139,
131,244,249,65,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233, 105,232,139,65,252,236,137,41,137,65,4,139,105,252,240,139,65,252,244,137,
15,130,244,2,248,3,68,139,60,36,139,3,15,182,204,15,182,232,131,195,4,193, 105,8,137,65,12,139,105,224,139,65,228,137,105,252,248,137,65,252,252,129,
232,16,65,252,255,36,252,238,248,5,199,68,36,4,1,0,0,0,137,208,68,41,252, 252,248,239,184,237,15,133,244,28,137,202,137,90,252,252,139,157,233,139,
248,15,134,244,3,255,137,197,193,252,237,3,131,197,1,137,108,36,4,139,108, 11,15,182,252,233,15,182,205,131,195,4,65,252,255,36,252,238,255,15,182,252,
36,24,1,200,59,133,233,15,135,244,253,248,6,65,139,71,252,248,137,1,65,139, 236,139,66,252,248,141,12,202,139,128,233,15,182,128,233,68,137,60,36,68,
71,252,252,65,131,199,8,137,65,4,131,193,8,65,57,215,15,130,244,6,252,233, 141,188,253,194,233,68,43,122,252,252,133,252,237,15,132,244,251,141,108,
244,3,248,7,137,149,233,137,141,233,137,92,36,28,65,41,215,139,116,36,4,131, 252,233,252,248,65,57,215,15,131,244,248,248,1,65,139,71,252,248,137,1,65,
252,238,1,137,252,239,232,251,1,0,139,149,233,139,141,233,65,1,215,252,233, 139,71,252,252,65,131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,
244,6,255,193,225,3,255,248,1,139,90,252,252,137,68,36,4,252,247,195,237, 65,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,
15,133,244,253,255,248,13,65,137,215,131,232,1,15,132,244,249,248,2,65,139, 2,248,3,68,139,60,36,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,
44,15,65,137,111,252,248,65,139,108,15,4,65,137,111,252,252,65,131,199,8, 252,255,36,252,238,248,5,199,68,36,4,1,0,0,0,137,208,68,41,252,248,15,134,
131,232,1,15,133,244,2,248,3,139,68,36,4,15,182,107,252,255,248,5,57,197, 244,3,255,137,197,193,252,237,3,131,197,1,137,108,36,4,139,108,36,24,1,200,
15,135,244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248, 59,133,233,15,135,244,253,248,6,65,139,71,252,248,137,1,65,139,71,252,252,
255,248,5,56,67,252,255,15,135,244,252,255,15,182,75,252,253,72,252,247,209, 65,131,199,8,137,65,4,131,193,8,65,57,215,15,130,244,6,252,233,244,3,248,
141,20,202,68,139,122,252,248,69,139,191,233,69,139,191,233,139,3,15,182, 7,137,149,233,137,141,233,137,92,36,28,65,41,215,139,116,36,4,131,252,238,
204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,6,255,65,199, 1,137,252,239,232,251,1,0,139,149,233,139,141,233,65,1,215,252,233,244,6,
71,252,252,237,65,131,199,8,255,199,68,194,252,244,237,255,131,192,1,252, 255,193,225,3,255,248,1,139,90,252,252,137,68,36,4,252,247,195,237,15,133,
233,244,5,248,7,141,171,233,252,247,197,237,15,133,244,14,41,252,234,255, 244,253,255,248,13,65,137,215,131,232,1,15,132,244,249,248,2,65,139,44,15,
1,252,233,255,137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1, 65,137,111,252,248,65,139,108,15,4,65,137,111,252,252,65,131,199,8,131,232,
15,132,244,140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,129,121, 1,15,133,244,2,248,3,139,68,36,4,15,182,107,252,255,248,5,57,197,15,135,244,
253,12,239,15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,244,53, 252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,248,5,
255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242,15, 56,67,252,255,15,135,244,252,255,15,182,75,252,253,72,252,247,209,141,20,
17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,248, 202,68,139,122,252,248,69,139,191,233,69,139,191,233,139,3,15,182,204,15,
1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133, 182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,6,255,65,199,71,252,
252,237,15,136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,1,255, 252,237,65,131,199,8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,
15,183,67,252,254,255,15,131,244,248,141,156,253,131,233,255,141,156,253, 5,248,7,141,171,233,252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,
131,233,15,183,67,252,254,15,131,245,255,15,130,244,248,141,156,253,131,233, 255,137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1,15,132,244,
255,248,3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253, 140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,
239,15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245, 15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,
255,141,156,253,131,233,139,1,137,105,252,252,137,65,252,248,255,65,139,142, 15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,
233,139,4,129,72,139,128,233,139,108,36,24,65,137,150,233,65,137,174,233, 237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,
76,137,36,36,76,137,108,36,8,72,131,252,236,16,252,255,224,255,141,156,253, 17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,
131,233,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252, 136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,67,
238,255,137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1,15,132, 252,254,255,15,131,244,248,141,156,253,131,233,255,141,156,253,131,233,15,
244,142,255,68,139,187,233,139,108,36,24,141,12,202,59,141,233,15,135,244, 183,67,252,254,15,131,245,255,15,130,244,248,141,156,253,131,233,255,248,
23,15,182,139,233,57,200,15,134,244,249,248,2,255,15,183,67,252,254,252,233, 3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,
245,255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233, 132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245,255,141,
244,2,255,141,44,197,237,141,4,194,68,139,122,252,248,137,104,252,252,68, 156,253,131,233,139,1,137,105,252,252,137,65,252,248,255,65,139,142,233,139,
137,120,252,248,139,108,36,24,141,12,200,59,141,233,15,135,244,22,137,209, 4,129,72,139,128,233,139,108,36,24,65,137,150,233,65,137,174,233,76,137,36,
137,194,15,182,171,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209, 36,76,137,108,36,8,72,131,252,236,16,252,255,224,255,141,156,253,131,233,
15,131,244,249,68,139,121,252,248,68,137,56,68,139,121,252,252,68,137,120, 139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255,
4,131,192,8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,68,139, 137,221,209,252,237,129,229,239,102,65,131,172,253,46,233,1,15,132,244,142,
187,233,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252, 255,68,139,187,233,139,108,36,24,141,12,202,59,141,233,15,135,244,23,15,182,
238,255,248,3,199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244, 139,233,57,200,15,134,244,249,248,2,255,15,183,67,252,254,252,233,245,255,
2,255,139,106,252,248,76,139,189,233,139,108,36,24,141,68,194,252,248,137, 248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233,244,2,
149,233,141,136,233,59,141,233,137,133,233,255,137,252,239,255,76,137,252, 255,141,44,197,237,141,4,194,68,139,122,252,248,137,104,252,252,68,137,120,
254,137,252,239,255,15,135,244,21,65,199,134,233,237,255,65,252,255,215,255, 252,248,139,108,36,24,141,12,200,59,141,233,15,135,244,22,137,209,137,194,
65,252,255,150,233,255,65,199,134,233,237,139,149,233,141,12,194,252,247, 15,182,171,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209,15,131,244,
217,3,141,233,139,90,252,252,252,233,244,12,255,254,0 249,68,139,121,252,248,68,137,56,68,139,121,252,252,68,137,120,4,131,192,
8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,68,139,187,233,
139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255,
248,3,199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,
139,106,252,248,76,139,189,233,139,108,36,24,141,68,194,252,248,137,149,233,
141,136,233,59,141,233,137,133,233,255,137,252,239,255,76,137,252,254,137,
252,239,255,15,135,244,21,65,199,134,233,237,255,65,252,255,215,255,65,252,
255,150,233,255,65,199,134,233,237,139,149,233,141,12,194,252,247,217,3,141,
233,139,90,252,252,252,233,244,12,255,254,0
}; };
enum { enum {
@ -1962,13 +1962,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_TSETM: case BC_TSETM:
dasm_put(Dst, 12502); dasm_put(Dst, 12502, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
if (sse) { dasm_put(Dst, 12658, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
dasm_put(Dst, 12507);
} else {
}
dasm_put(Dst, 12515, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
dasm_put(Dst, 12663, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break; break;
/* -- Calls and vararg handling ----------------------------------------- */ /* -- Calls and vararg handling ----------------------------------------- */
@ -1976,60 +1971,60 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_CALL: case BC_CALLM: case BC_CALL: case BC_CALLM:
dasm_put(Dst, 10113); dasm_put(Dst, 10113);
if (op == BC_CALLM) { if (op == BC_CALLM) {
dasm_put(Dst, 12683); dasm_put(Dst, 12678);
} }
dasm_put(Dst, 12688, LJ_TFUNC, Dt7(->pc)); dasm_put(Dst, 12683, LJ_TFUNC, Dt7(->pc));
break; break;
case BC_CALLMT: case BC_CALLMT:
dasm_put(Dst, 12683); dasm_put(Dst, 12678);
break; break;
case BC_CALLT: case BC_CALLT:
dasm_put(Dst, 12731, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); dasm_put(Dst, 12726, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
dasm_put(Dst, 12855, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); dasm_put(Dst, 12850, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break; break;
case BC_ITERC: case BC_ITERC:
dasm_put(Dst, 12929, LJ_TFUNC, 2+1, Dt7(->pc)); dasm_put(Dst, 12924, LJ_TFUNC, 2+1, Dt7(->pc));
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 13011, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 13006, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL);
dasm_put(Dst, 13165, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 13160, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
case BC_RETM: case BC_RETM:
dasm_put(Dst, 12683); dasm_put(Dst, 12678);
break; break;
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, 13270); dasm_put(Dst, 13265);
} }
dasm_put(Dst, 13274, FRAME_TYPE); dasm_put(Dst, 13269, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 13293); dasm_put(Dst, 13288);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 13357); dasm_put(Dst, 13352);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 13373); dasm_put(Dst, 13368);
default: default:
break; break;
} }
dasm_put(Dst, 13384, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 13379, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 13432, LJ_TNIL); dasm_put(Dst, 13427, LJ_TNIL);
} else { } else {
dasm_put(Dst, 13443, LJ_TNIL); dasm_put(Dst, 13438, LJ_TNIL);
} }
dasm_put(Dst, 13450, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 13445, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13474); dasm_put(Dst, 13469);
} }
dasm_put(Dst, 4599); dasm_put(Dst, 4599);
break; break;
@ -2039,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, 13478, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2051,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, 13499); dasm_put(Dst, 13494);
if (!vk) { if (!vk) {
dasm_put(Dst, 13503, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 13498, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 13522); dasm_put(Dst, 13517);
if (!vk) { if (!vk) {
dasm_put(Dst, 13526, LJ_TISNUM); dasm_put(Dst, 13521, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 13535); dasm_put(Dst, 13530);
if (vk) { if (vk) {
dasm_put(Dst, 13547); dasm_put(Dst, 13542);
} else { } else {
dasm_put(Dst, 13566); dasm_put(Dst, 13561);
} }
dasm_put(Dst, 13571); dasm_put(Dst, 13566);
} else { } else {
dasm_put(Dst, 13584); dasm_put(Dst, 13579);
if (vk) { if (vk) {
dasm_put(Dst, 13590); dasm_put(Dst, 13585);
} else { } else {
dasm_put(Dst, 13606); dasm_put(Dst, 13601);
} }
dasm_put(Dst, 13614); 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, 13619); dasm_put(Dst, 13614);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 13625, -BCBIAS_J*4); dasm_put(Dst, 13620, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 13635, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 13630, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 13649, -BCBIAS_J*4); dasm_put(Dst, 13644, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 13645, BC_JLOOP); dasm_put(Dst, 13640, BC_JLOOP);
} }
dasm_put(Dst, 9563); dasm_put(Dst, 9563);
if (sse) { if (sse) {
dasm_put(Dst, 13659); dasm_put(Dst, 13654);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13478, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2110,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, 13670, LJ_TNIL); dasm_put(Dst, 13665, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 13685, BC_JLOOP); dasm_put(Dst, 13680, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13699, -BCBIAS_J*4); dasm_put(Dst, 13694, -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, 13478, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13473, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2131,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, 13715, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); dasm_put(Dst, 13710, 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, 13756, -BCBIAS_J*4); dasm_put(Dst, 13751, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2150,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, 13782, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13777, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2160,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, 13803, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 13798, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 13834, BC_JLOOP); dasm_put(Dst, 13829, BC_JLOOP);
} else { } else {
dasm_put(Dst, 9565); dasm_put(Dst, 9565);
} }
dasm_put(Dst, 13843, LJ_TNIL); dasm_put(Dst, 13838, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2177,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, 13865, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 13860, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 13834, BC_JLOOP); dasm_put(Dst, 13829, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13962, -4+PC2PROTO(k)); dasm_put(Dst, 13957, -4+PC2PROTO(k));
} }
dasm_put(Dst, 13987, LJ_TNIL); dasm_put(Dst, 13982, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 14009, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 14004, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14039); dasm_put(Dst, 14034);
} else { } else {
dasm_put(Dst, 14043); dasm_put(Dst, 14038);
} }
dasm_put(Dst, 14051, DISPATCH_GL(vmstate), ~LJ_VMST_C); dasm_put(Dst, 14046, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14061); dasm_put(Dst, 14056);
} else { } else {
dasm_put(Dst, 14066, DISPATCH_GL(wrapf)); dasm_put(Dst, 14061, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 14072, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 14067, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2228,7 +2223,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 14098); dasm_put(Dst, 14093);
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[14047] = { static const unsigned char build_actionlist[14042] = {
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,
@ -617,85 +617,85 @@ static const unsigned char build_actionlist[14047] = {
16,252,255,36,252,235,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252, 16,252,255,36,252,235,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252,
246,129,233,235,15,132,244,38,15,182,78,252,253,252,233,244,1,248,7,128,165, 246,129,233,235,15,132,244,38,15,182,78,252,253,252,233,244,1,248,7,128,165,
233,235,139,139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244, 233,235,139,139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,
2,255,137,124,36,80,255,252,242,15,45,60,199,255,248,1,141,12,202,139,105, 2,255,137,124,36,80,139,60,199,248,1,141,12,202,139,105,252,248,252,246,133,
252,248,252,246,133,233,235,15,133,244,253,248,2,139,68,36,84,131,232,1,15, 233,235,15,133,244,253,248,2,139,68,36,84,131,232,1,15,132,244,250,1,252,
132,244,250,1,252,248,59,133,233,15,131,244,251,41,252,248,193,231,3,3,189, 248,59,133,233,15,131,244,251,41,252,248,193,231,3,3,189,233,248,3,139,41,
233,248,3,139,41,137,47,139,105,4,131,193,8,137,111,4,131,199,8,131,232,1, 137,47,139,105,4,131,193,8,137,111,4,131,199,8,131,232,1,15,133,244,3,248,
15,133,244,3,248,4,139,124,36,80,139,6,15,182,204,15,182,232,131,198,4,193, 4,139,124,36,80,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
232,16,252,255,36,252,235,248,5,139,76,36,96,137,145,233,137,252,234,65,137, 36,252,235,248,5,139,76,36,96,137,145,233,137,252,234,65,137,192,137,205,
192,137,205,137,116,36,100,232,251,1,33,139,149,233,15,182,78,252,253,252, 137,116,36,100,232,251,1,33,139,149,233,15,182,78,252,253,252,233,244,1,248,
233,244,1,248,7,255,128,165,233,235,139,131,233,137,171,233,137,133,233,252, 7,255,128,165,233,235,139,131,233,137,171,233,137,133,233,252,233,244,2,255,
233,244,2,255,3,68,36,84,255,129,124,253,202,4,239,139,44,202,15,133,244, 3,68,36,84,255,129,124,253,202,4,239,139,44,202,15,133,244,51,141,84,202,
51,141,84,202,8,137,114,252,252,139,181,233,139,14,15,182,252,233,15,182, 8,137,114,252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,4,
205,131,198,4,252,255,36,252,235,255,141,76,202,8,137,215,139,105,252,248, 252,255,36,252,235,255,141,76,202,8,137,215,139,105,252,248,129,121,253,252,
129,121,253,252,252,239,15,133,244,28,248,52,139,114,252,252,252,247,198, 252,239,15,133,244,28,248,52,139,114,252,252,252,247,198,237,15,133,244,253,
237,15,133,244,253,248,1,137,106,252,248,137,68,36,84,131,232,1,15,132,244, 248,1,137,106,252,248,137,68,36,84,131,232,1,15,132,244,249,248,2,139,41,
249,248,2,139,41,137,47,139,105,4,137,111,4,131,199,8,131,193,8,131,232,1, 137,47,139,105,4,137,111,4,131,199,8,131,193,8,131,232,1,15,133,244,2,139,
15,133,244,2,139,106,252,248,248,3,139,68,36,84,128,189,233,1,15,135,244, 106,252,248,248,3,139,68,36,84,128,189,233,1,15,135,244,251,248,4,139,181,
251,248,4,139,181,233,139,14,15,182,252,233,15,182,205,131,198,4,252,255, 233,139,14,15,182,252,233,15,182,205,131,198,4,252,255,36,252,235,248,5,255,
36,252,235,248,5,255,252,247,198,237,15,133,244,4,15,182,78,252,253,72,252, 252,247,198,237,15,133,244,4,15,182,78,252,253,72,252,247,209,141,12,202,
247,209,141,12,202,139,121,252,248,139,191,233,139,191,233,252,233,244,4, 139,121,252,248,139,191,233,139,191,233,252,233,244,4,248,7,129,252,238,239,
248,7,129,252,238,239,252,247,198,237,15,133,244,254,41,252,242,137,215,139, 252,247,198,237,15,133,244,254,41,252,242,137,215,139,114,252,252,252,233,
114,252,252,252,233,244,1,248,8,129,198,239,252,233,244,1,255,141,76,202, 244,1,248,8,129,198,239,252,233,244,1,255,141,76,202,8,139,105,232,139,65,
8,139,105,232,139,65,252,236,137,41,137,65,4,139,105,252,240,139,65,252,244, 252,236,137,41,137,65,4,139,105,252,240,139,65,252,244,137,105,8,137,65,12,
137,105,8,137,65,12,139,105,224,139,65,228,137,105,252,248,137,65,252,252, 139,105,224,139,65,228,137,105,252,248,137,65,252,252,129,252,248,239,184,
129,252,248,239,184,237,15,133,244,28,137,202,137,114,252,252,139,181,233, 237,15,133,244,28,137,202,137,114,252,252,139,181,233,139,14,15,182,252,233,
139,14,15,182,252,233,15,182,205,131,198,4,252,255,36,252,235,255,15,182, 15,182,205,131,198,4,252,255,36,252,235,255,15,182,252,236,139,66,252,248,
252,236,139,66,252,248,141,12,202,139,128,233,15,182,128,233,137,124,36,80, 141,12,202,139,128,233,15,182,128,233,137,124,36,80,141,188,253,194,233,43,
141,188,253,194,233,43,122,252,252,133,252,237,15,132,244,251,141,108,252, 122,252,252,133,252,237,15,132,244,251,141,108,252,233,252,248,57,215,15,
233,252,248,57,215,15,131,244,248,248,1,139,71,252,248,137,1,139,71,252,252, 131,244,248,248,1,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,
131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,57,215,15,130,244, 131,193,8,57,252,233,15,131,244,249,57,215,15,130,244,1,248,2,199,65,4,237,
1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,2,248,3,139,124,36,80, 131,193,8,57,252,233,15,130,244,2,248,3,139,124,36,80,139,6,15,182,204,15,
139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,5, 182,232,131,198,4,193,232,16,252,255,36,252,235,248,5,199,68,36,84,1,0,0,
199,68,36,84,1,0,0,0,137,208,41,252,248,15,134,244,3,255,137,197,193,252, 0,137,208,41,252,248,15,134,244,3,255,137,197,193,252,237,3,131,197,1,137,
237,3,131,197,1,137,108,36,84,139,108,36,96,1,200,59,133,233,15,135,244,253, 108,36,84,139,108,36,96,1,200,59,133,233,15,135,244,253,248,6,139,71,252,
248,6,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57, 248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,215,15,130,244,6,
215,15,130,244,6,252,233,244,3,248,7,137,149,233,137,141,233,137,116,36,100, 252,233,244,3,248,7,137,149,233,137,141,233,137,116,36,100,41,215,139,84,
41,215,139,84,36,84,131,252,234,1,137,252,233,232,251,1,0,139,149,233,139, 36,84,131,252,234,1,137,252,233,232,251,1,0,139,149,233,139,141,233,1,215,
141,233,1,215,252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68, 252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68,36,84,252,247,
36,84,252,247,198,237,15,133,244,253,255,248,13,137,215,131,232,1,15,132, 198,237,15,133,244,253,255,248,13,137,215,131,232,1,15,132,244,249,248,2,
244,249,248,2,139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131, 139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131,199,8,131,232,
199,8,131,232,1,15,133,244,2,248,3,139,68,36,84,15,182,110,252,255,248,5, 1,15,133,244,2,248,3,139,68,36,84,15,182,110,252,255,248,5,57,197,15,135,
57,197,15,135,244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106, 244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,248,
252,248,255,248,5,56,70,252,255,15,135,244,252,255,15,182,78,252,253,72,252, 5,56,70,252,255,15,135,244,252,255,15,182,78,252,253,72,252,247,209,141,20,
247,209,141,20,202,139,122,252,248,139,191,233,139,191,233,139,6,15,182,204, 202,139,122,252,248,139,191,233,139,191,233,139,6,15,182,204,15,182,232,131,
15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,6,255,199,71,252,252, 198,4,193,232,16,252,255,36,252,235,248,6,255,199,71,252,252,237,131,199,
237,131,199,8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,5,248, 8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,5,248,7,141,174,233,
7,141,174,233,252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,255, 252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,255,137,252,245,209,
137,252,245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,140, 252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,140,255,141,12,202,
255,141,12,202,255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,15, 255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,15,135,244,53,255,
135,244,53,255,139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,15, 139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,15,16,1,252,242,
16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237, 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,
15,136,244,249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65, 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,
24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244, 65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244,247,255,
247,255,221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,70,252,254, 221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,70,252,254,255,15,131,
255,15,131,244,248,141,180,253,134,233,255,141,180,253,134,233,15,183,70, 244,248,141,180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,
252,254,15,131,245,255,15,130,244,248,141,180,253,134,233,255,248,3,102,15, 131,245,255,15,130,244,248,141,180,253,134,233,255,248,3,102,15,46,193,252,
46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,132,244, 233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,132,244,247,255,137,
247,255,137,105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253, 105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253,134,233,139,
134,233,139,1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,72, 1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,72,139,128,233,
139,128,233,139,108,36,96,137,147,233,137,171,233,76,137,100,36,80,76,137, 139,108,36,96,137,147,233,137,171,233,76,137,100,36,80,76,137,108,36,32,76,
108,36,32,76,137,116,36,24,76,137,124,36,16,72,137,225,72,129,252,236,239, 137,116,36,24,76,137,124,36,16,72,137,225,72,129,252,236,239,102,15,127,49,
102,15,127,49,102,15,127,185,233,102,68,15,127,129,233,102,68,15,127,137, 102,15,127,185,233,102,68,15,127,129,233,102,68,15,127,137,233,102,68,15,
233,102,68,15,127,145,233,102,68,15,127,153,233,102,68,15,127,161,233,102, 127,145,233,102,68,15,127,153,233,102,68,15,127,161,233,102,68,15,127,169,
68,15,127,169,233,102,68,15,127,177,233,102,68,15,127,185,233,252,255,224, 233,102,68,15,127,177,233,102,68,15,127,185,233,252,255,224,255,141,180,253,
255,141,180,253,134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,
252,255,36,252,235,255,137,252,245,209,252,237,129,229,239,102,131,172,253, 255,137,252,245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,
43,233,1,15,132,244,142,255,139,190,233,139,108,36,96,141,12,202,59,141,233, 142,255,139,190,233,139,108,36,96,141,12,202,59,141,233,15,135,244,23,15,
15,135,244,23,15,182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252, 182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252,254,252,233,245,
254,252,233,245,255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134, 255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233,244,
244,3,252,233,244,2,255,141,44,197,237,141,4,194,139,122,252,248,137,104, 2,255,141,44,197,237,141,4,194,139,122,252,248,137,104,252,252,137,120,252,
252,252,137,120,252,248,139,108,36,96,141,12,200,59,141,233,15,135,244,22, 248,139,108,36,96,141,12,200,59,141,233,15,135,244,22,137,209,137,194,15,
137,209,137,194,15,182,174,233,133,252,237,15,132,244,248,248,1,131,193,8, 182,174,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209,15,131,244,
57,209,15,131,244,249,139,121,252,248,137,56,139,121,252,252,137,120,4,131, 249,139,121,252,248,137,56,139,121,252,252,137,120,4,131,192,8,199,65,252,
192,8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233, 252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233,139,6,15,182,204,
139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,255,248, 15,182,232,131,198,4,193,232,16,252,255,36,252,235,255,248,3,199,64,4,237,
3,199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139, 131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106,252,248,72,
106,252,248,72,139,189,233,139,108,36,96,141,68,194,252,248,137,149,233,141, 139,189,233,139,108,36,96,141,68,194,252,248,137,149,233,141,136,233,59,141,
136,233,59,141,233,137,133,233,255,137,252,233,255,72,137,252,250,137,252, 233,137,133,233,255,137,252,233,255,72,137,252,250,137,252,233,255,15,135,
233,255,15,135,244,21,199,131,233,237,255,252,255,215,255,252,255,147,233, 244,21,199,131,233,237,255,252,255,215,255,252,255,147,233,255,199,131,233,
255,199,131,233,237,139,149,233,141,12,194,252,247,217,3,141,233,139,114, 237,139,149,233,141,12,194,252,247,217,3,141,233,139,114,252,252,252,233,
252,252,252,233,244,12,255,254,0 244,12,255,254,0
}; };
enum { enum {
@ -1965,13 +1965,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_TSETM: case BC_TSETM:
dasm_put(Dst, 12443); dasm_put(Dst, 12443, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
if (sse) { dasm_put(Dst, 12590, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
dasm_put(Dst, 12448);
} else {
}
dasm_put(Dst, 12455, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
dasm_put(Dst, 12595, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break; break;
/* -- Calls and vararg handling ----------------------------------------- */ /* -- Calls and vararg handling ----------------------------------------- */
@ -1979,60 +1974,60 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_CALL: case BC_CALLM: case BC_CALL: case BC_CALLM:
dasm_put(Dst, 10113); dasm_put(Dst, 10113);
if (op == BC_CALLM) { if (op == BC_CALLM) {
dasm_put(Dst, 12613); dasm_put(Dst, 12608);
} }
dasm_put(Dst, 12618, LJ_TFUNC, Dt7(->pc)); dasm_put(Dst, 12613, LJ_TFUNC, Dt7(->pc));
break; break;
case BC_CALLMT: case BC_CALLMT:
dasm_put(Dst, 12613); dasm_put(Dst, 12608);
break; break;
case BC_CALLT: case BC_CALLT:
dasm_put(Dst, 12660, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); dasm_put(Dst, 12655, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
dasm_put(Dst, 12779, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); dasm_put(Dst, 12774, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break; break;
case BC_ITERC: case BC_ITERC:
dasm_put(Dst, 12850, LJ_TFUNC, 2+1, Dt7(->pc)); dasm_put(Dst, 12845, LJ_TFUNC, 2+1, Dt7(->pc));
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 12931, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 12926, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL);
dasm_put(Dst, 13076, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 13071, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
case BC_RETM: case BC_RETM:
dasm_put(Dst, 12613); dasm_put(Dst, 12608);
break; break;
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, 13175); dasm_put(Dst, 13170);
} }
dasm_put(Dst, 13179, FRAME_TYPE); dasm_put(Dst, 13174, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 13198); dasm_put(Dst, 13193);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 13256); dasm_put(Dst, 13251);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 13272); dasm_put(Dst, 13267);
default: default:
break; break;
} }
dasm_put(Dst, 13283, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 13278, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 13327, LJ_TNIL); dasm_put(Dst, 13322, LJ_TNIL);
} else { } else {
dasm_put(Dst, 13336, LJ_TNIL); dasm_put(Dst, 13331, LJ_TNIL);
} }
dasm_put(Dst, 13343, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 13338, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 13367); dasm_put(Dst, 13362);
} }
dasm_put(Dst, 4573); dasm_put(Dst, 4573);
break; break;
@ -2042,7 +2037,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, 13371, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2054,57 +2049,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, 13392); dasm_put(Dst, 13387);
if (!vk) { if (!vk) {
dasm_put(Dst, 13396, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 13391, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 13415); dasm_put(Dst, 13410);
if (!vk) { if (!vk) {
dasm_put(Dst, 13419, LJ_TISNUM); dasm_put(Dst, 13414, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 13428); dasm_put(Dst, 13423);
if (vk) { if (vk) {
dasm_put(Dst, 13440); dasm_put(Dst, 13435);
} else { } else {
dasm_put(Dst, 13459); dasm_put(Dst, 13454);
} }
dasm_put(Dst, 13464); dasm_put(Dst, 13459);
} else { } else {
dasm_put(Dst, 13477); dasm_put(Dst, 13472);
if (vk) { if (vk) {
dasm_put(Dst, 13483); dasm_put(Dst, 13478);
} else { } else {
dasm_put(Dst, 13499); dasm_put(Dst, 13494);
} }
dasm_put(Dst, 13507); 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, 13512); dasm_put(Dst, 13507);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 13518, -BCBIAS_J*4); dasm_put(Dst, 13513, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 13528, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 13523, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 13542, -BCBIAS_J*4); dasm_put(Dst, 13537, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 13538, BC_JLOOP); dasm_put(Dst, 13533, BC_JLOOP);
} }
dasm_put(Dst, 9571); dasm_put(Dst, 9571);
if (sse) { if (sse) {
dasm_put(Dst, 13552); dasm_put(Dst, 13547);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 13371, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2113,18 +2108,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, 13563, LJ_TNIL); dasm_put(Dst, 13558, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 13578, BC_JLOOP); dasm_put(Dst, 13573, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13592, -BCBIAS_J*4); dasm_put(Dst, 13587, -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, 13371, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13366, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2134,12 +2129,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, 13608, 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, 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);
#endif #endif
break; break;
case BC_JMP: case BC_JMP:
dasm_put(Dst, 13717, -BCBIAS_J*4); dasm_put(Dst, 13712, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2153,7 +2148,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, 13742, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 13737, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2163,13 +2158,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, 13763, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 13758, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 13793, BC_JLOOP); dasm_put(Dst, 13788, BC_JLOOP);
} else { } else {
dasm_put(Dst, 9573); dasm_put(Dst, 9573);
} }
dasm_put(Dst, 13802, LJ_TNIL); dasm_put(Dst, 13797, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2180,30 +2175,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, 13824, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 13819, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 13793, BC_JLOOP); dasm_put(Dst, 13788, BC_JLOOP);
} else { } else {
dasm_put(Dst, 13915, -4+PC2PROTO(k)); dasm_put(Dst, 13910, -4+PC2PROTO(k));
} }
dasm_put(Dst, 13938, LJ_TNIL); dasm_put(Dst, 13933, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 13960, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 13955, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 13990); dasm_put(Dst, 13985);
} else { } else {
dasm_put(Dst, 13994); dasm_put(Dst, 13989);
} }
dasm_put(Dst, 14002, DISPATCH_GL(vmstate), ~LJ_VMST_C); dasm_put(Dst, 13997, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 14011); dasm_put(Dst, 14006);
} else { } else {
dasm_put(Dst, 14015, DISPATCH_GL(wrapf)); dasm_put(Dst, 14010, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 14020, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 14015, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2231,7 +2226,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 14045); dasm_put(Dst, 14040);
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[15252] = { static const unsigned char build_actionlist[15235] = {
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,
@ -675,80 +675,80 @@ static const unsigned char build_actionlist[15252] = {
255,36,171,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252,246,129,233, 255,36,171,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252,246,129,233,
235,15,132,244,38,15,182,78,252,253,252,233,244,1,248,7,128,165,233,235,139, 235,15,132,244,38,15,182,78,252,253,252,233,244,1,248,7,128,165,233,235,139,
139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,2,255,137,124, 139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,2,255,137,124,
36,16,255,252,242,15,45,60,199,255,221,4,199,219,92,36,12,139,124,36,12,255, 36,16,139,60,199,248,1,141,12,202,139,105,252,248,252,246,133,233,235,15,
248,1,141,12,202,139,105,252,248,252,246,133,233,235,15,133,244,253,248,2, 133,244,253,248,2,139,68,36,20,131,232,1,15,132,244,250,1,252,248,59,133,
139,68,36,20,131,232,1,15,132,244,250,1,252,248,59,133,233,15,131,244,251, 233,15,131,244,251,41,252,248,193,231,3,3,189,233,248,3,139,41,137,47,139,
41,252,248,193,231,3,3,189,233,248,3,139,41,137,47,139,105,4,131,193,8,137, 105,4,131,193,8,137,111,4,131,199,8,131,232,1,15,133,244,3,248,4,139,124,
111,4,131,199,8,131,232,1,15,133,244,3,248,4,139,124,36,16,139,6,15,182,204,
15,182,232,131,198,4,193,232,16,252,255,36,171,248,5,137,108,36,4,139,108,
36,48,137,149,233,137,68,36,8,137,44,36,137,116,36,24,232,251,1,33,139,149,
233,15,182,78,252,253,252,233,244,1,248,7,255,128,165,233,235,139,131,233,
137,171,233,137,133,233,252,233,244,2,255,3,68,36,20,255,129,124,253,202,
4,239,139,44,202,15,133,244,51,141,84,202,8,137,114,252,252,139,181,233,139,
14,15,182,252,233,15,182,205,131,198,4,252,255,36,171,255,141,76,202,8,137,
215,139,105,252,248,129,121,253,252,252,239,15,133,244,28,248,52,139,114,
252,252,252,247,198,237,15,133,244,253,248,1,137,106,252,248,137,68,36,20,
131,232,1,15,132,244,249,248,2,139,41,137,47,139,105,4,137,111,4,131,199,
8,131,193,8,131,232,1,15,133,244,2,139,106,252,248,248,3,139,68,36,20,128,
189,233,1,15,135,244,251,248,4,139,181,233,139,14,15,182,252,233,15,182,205,
131,198,4,252,255,36,171,248,5,255,252,247,198,237,15,133,244,4,15,182,78,
252,253,252,247,209,141,12,202,139,121,252,248,139,191,233,139,191,233,252,
233,244,4,248,7,129,252,238,239,252,247,198,237,15,133,244,254,41,252,242,
137,215,139,114,252,252,252,233,244,1,248,8,129,198,239,252,233,244,1,255,
141,76,202,8,139,105,232,139,65,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,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,171,255,
15,182,252,236,139,66,252,248,141,12,202,139,128,233,15,182,128,233,137,124,
36,16,141,188,253,194,233,43,122,252,252,133,252,237,15,132,244,251,141,108,
252,233,252,248,57,215,15,131,244,248,248,1,139,71,252,248,137,1,139,71,252,
252,131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,57,215,15,130,
244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,2,248,3,139,124,
36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248, 36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
5,199,68,36,20,1,0,0,0,137,208,41,252,248,15,134,244,3,255,137,197,193,252, 5,137,108,36,4,139,108,36,48,137,149,233,137,68,36,8,137,44,36,137,116,36,
237,3,131,197,1,137,108,36,20,139,108,36,48,1,200,59,133,233,15,135,244,253, 24,232,251,1,33,139,149,233,15,182,78,252,253,252,233,244,1,248,7,255,128,
248,6,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57, 165,233,235,139,131,233,137,171,233,137,133,233,252,233,244,2,255,3,68,36,
215,15,130,244,6,252,233,244,3,248,7,137,149,233,137,141,233,137,116,36,24, 20,255,129,124,253,202,4,239,139,44,202,15,133,244,51,141,84,202,8,137,114,
41,215,139,84,36,20,131,252,234,1,137,252,233,232,251,1,0,139,149,233,139, 252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,4,252,255,36,
141,233,1,215,252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68, 171,255,141,76,202,8,137,215,139,105,252,248,129,121,253,252,252,239,15,133,
36,20,252,247,198,237,15,133,244,253,255,248,13,137,215,131,232,1,15,132, 244,28,248,52,139,114,252,252,252,247,198,237,15,133,244,253,248,1,137,106,
244,249,248,2,139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131, 252,248,137,68,36,20,131,232,1,15,132,244,249,248,2,139,41,137,47,139,105,
199,8,131,232,1,15,133,244,2,248,3,139,68,36,20,15,182,110,252,255,248,5, 4,137,111,4,131,199,8,131,193,8,131,232,1,15,133,244,2,139,106,252,248,248,
57,197,15,135,244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106, 3,139,68,36,20,128,189,233,1,15,135,244,251,248,4,139,181,233,139,14,15,182,
252,248,255,248,5,56,70,252,255,15,135,244,252,255,15,182,78,252,253,252, 252,233,15,182,205,131,198,4,252,255,36,171,248,5,255,252,247,198,237,15,
247,209,141,20,202,139,122,252,248,139,191,233,139,191,233,139,6,15,182,204, 133,244,4,15,182,78,252,253,252,247,209,141,12,202,139,121,252,248,139,191,
15,182,232,131,198,4,193,232,16,252,255,36,171,248,6,255,199,71,252,252,237, 233,139,191,233,252,233,244,4,248,7,129,252,238,239,252,247,198,237,15,133,
131,199,8,255,199,68,194,252,244,237,255,131,192,1,252,233,244,5,248,7,141, 244,254,41,252,242,137,215,139,114,252,252,252,233,244,1,248,8,129,198,239,
174,233,252,247,197,237,15,133,244,14,41,252,234,255,1,252,233,255,137,252, 252,233,244,1,255,141,76,202,8,139,105,232,139,65,252,236,137,41,137,65,4,
245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,140,255,141, 139,105,252,240,139,65,252,244,137,105,8,137,65,12,139,105,224,139,65,228,
12,202,255,129,121,253,4,239,15,135,244,53,129,121,253,12,239,15,135,244, 137,105,252,248,137,65,252,252,129,252,248,239,184,237,15,133,244,28,137,
53,255,139,105,20,255,129,252,253,239,15,135,244,53,255,252,242,15,16,1,252, 202,137,114,252,252,139,181,233,139,14,15,182,252,233,15,182,205,131,198,
242,15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136, 4,252,255,36,171,255,15,182,252,236,139,66,252,248,141,12,202,139,128,233,
244,249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255, 15,182,128,233,137,124,36,16,141,188,253,194,233,43,122,252,252,133,252,237,
221,65,8,221,1,255,220,65,16,221,17,221,81,24,133,252,237,15,136,244,247, 15,132,244,251,141,108,252,233,252,248,57,215,15,131,244,248,248,1,139,71,
255,221,81,24,15,140,244,247,255,217,201,248,1,255,15,183,70,252,254,255, 252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,252,233,15,131,
15,131,244,248,141,180,253,134,233,255,141,180,253,134,233,15,183,70,252, 244,249,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,
254,15,131,245,255,15,130,244,248,141,180,253,134,233,255,248,3,102,15,46, 244,2,248,3,139,124,36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
193,252,233,244,1,255,141,12,202,139,105,4,129,252,253,239,15,132,244,247, 252,255,36,171,248,5,199,68,36,20,1,0,0,0,137,208,41,252,248,15,134,244,3,
255,137,105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253,134, 255,137,197,193,252,237,3,131,197,1,137,108,36,20,139,108,36,48,1,200,59,
233,139,1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,139,128, 133,233,15,135,244,253,248,6,139,71,252,248,137,1,139,71,252,252,131,199,
233,139,108,36,48,137,147,233,137,171,233,252,255,224,255,141,180,253,134, 8,137,65,4,131,193,8,57,215,15,130,244,6,252,233,244,3,248,7,137,149,233,
233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,137, 137,141,233,137,116,36,24,41,215,139,84,36,20,131,252,234,1,137,252,233,232,
252,245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,142,255, 251,1,0,139,149,233,139,141,233,1,215,252,233,244,6,255,193,225,3,255,248,
139,190,233,139,108,36,48,141,12,202,59,141,233,15,135,244,23,15,182,142, 1,139,114,252,252,137,68,36,20,252,247,198,237,15,133,244,253,255,248,13,
233,57,200,15,134,244,249,248,2,255,15,183,70,252,254,252,233,245,255,248, 137,215,131,232,1,15,132,244,249,248,2,139,44,15,137,111,252,248,139,108,
3,199,68,194,252,252,237,131,192,1,57,200,15,134,244,3,252,233,244,2,255, 15,4,137,111,252,252,131,199,8,131,232,1,15,133,244,2,248,3,139,68,36,20,
141,44,197,237,141,4,194,139,122,252,248,137,104,252,252,137,120,252,248, 15,182,110,252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,106,252,
139,108,36,48,141,12,200,59,141,233,15,135,244,22,137,209,137,194,15,182, 252,139,44,10,137,106,252,248,255,248,5,56,70,252,255,15,135,244,252,255,
174,233,133,252,237,15,132,244,248,248,1,131,193,8,57,209,15,131,244,249, 15,182,78,252,253,252,247,209,141,20,202,139,122,252,248,139,191,233,139,
139,121,252,248,137,56,139,121,252,252,137,120,4,131,192,8,199,65,252,252, 191,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
237,131,252,237,1,15,133,244,1,248,2,255,139,190,233,139,6,15,182,204,15, 6,255,199,71,252,252,237,131,199,8,255,199,68,194,252,244,237,255,131,192,
182,232,131,198,4,193,232,16,252,255,36,171,255,248,3,199,64,4,237,131,192, 1,252,233,244,5,248,7,141,174,233,252,247,197,237,15,133,244,14,41,252,234,
8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106,252,248,139,189,233, 255,1,252,233,255,137,252,245,209,252,237,129,229,239,102,131,172,253,43,
139,108,36,48,141,68,194,252,248,137,149,233,141,136,233,59,141,233,137,133, 233,1,15,132,244,140,255,141,12,202,255,129,121,253,4,239,15,135,244,53,129,
233,255,137,44,36,255,137,124,36,4,137,44,36,255,15,135,244,21,199,131,233, 121,253,12,239,15,135,244,53,255,139,105,20,255,129,252,253,239,15,135,244,
237,255,252,255,215,255,252,255,147,233,255,199,131,233,237,139,149,233,141, 53,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,16,252,242,
12,194,252,247,217,3,141,233,139,114,252,252,252,233,244,12,255,254,0 15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,15,46,200,248,
1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221,17,221,81,24,133,
252,237,15,136,244,247,255,221,81,24,15,140,244,247,255,217,201,248,1,255,
15,183,70,252,254,255,15,131,244,248,141,180,253,134,233,255,141,180,253,
134,233,15,183,70,252,254,15,131,245,255,15,130,244,248,141,180,253,134,233,
255,248,3,102,15,46,193,252,233,244,1,255,141,12,202,139,105,4,129,252,253,
239,15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245,
255,141,180,253,134,233,139,1,137,105,252,252,137,65,252,248,255,139,139,
233,139,4,129,139,128,233,139,108,36,48,137,147,233,137,171,233,252,255,224,
255,141,180,253,134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
252,255,36,171,255,137,252,245,209,252,237,129,229,239,102,131,172,253,43,
233,1,15,132,244,142,255,139,190,233,139,108,36,48,141,12,202,59,141,233,
15,135,244,23,15,182,142,233,57,200,15,134,244,249,248,2,255,15,183,70,252,
254,252,233,245,255,248,3,199,68,194,252,252,237,131,192,1,57,200,15,134,
244,3,252,233,244,2,255,141,44,197,237,141,4,194,139,122,252,248,137,104,
252,252,137,120,252,248,139,108,36,48,141,12,200,59,141,233,15,135,244,22,
137,209,137,194,15,182,174,233,133,252,237,15,132,244,248,248,1,131,193,8,
57,209,15,131,244,249,139,121,252,248,137,56,139,121,252,252,137,120,4,131,
192,8,199,65,252,252,237,131,252,237,1,15,133,244,1,248,2,255,139,190,233,
139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,248,3,
199,64,4,237,131,192,8,131,252,237,1,15,133,244,3,252,233,244,2,255,139,106,
252,248,139,189,233,139,108,36,48,141,68,194,252,248,137,149,233,141,136,
233,59,141,233,137,133,233,255,137,44,36,255,137,124,36,4,137,44,36,255,15,
135,244,21,199,131,233,237,255,252,255,215,255,252,255,147,233,255,199,131,
233,237,139,149,233,141,12,194,252,247,217,3,141,233,139,114,252,252,252,
233,244,12,255,254,0
}; };
enum { enum {
@ -2089,14 +2089,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; break;
case BC_TSETM: case BC_TSETM:
dasm_put(Dst, 13730); dasm_put(Dst, 13730, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
if (sse) { dasm_put(Dst, 13879, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
dasm_put(Dst, 13735);
} else {
dasm_put(Dst, 13742);
}
dasm_put(Dst, 13754, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
dasm_put(Dst, 13896, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break; break;
/* -- Calls and vararg handling ----------------------------------------- */ /* -- Calls and vararg handling ----------------------------------------- */
@ -2104,60 +2098,60 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_CALL: case BC_CALLM: case BC_CALL: case BC_CALLM:
dasm_put(Dst, 11397); dasm_put(Dst, 11397);
if (op == BC_CALLM) { if (op == BC_CALLM) {
dasm_put(Dst, 13914); dasm_put(Dst, 13897);
} }
dasm_put(Dst, 13919, LJ_TFUNC, Dt7(->pc)); dasm_put(Dst, 13902, LJ_TFUNC, Dt7(->pc));
break; break;
case BC_CALLMT: case BC_CALLMT:
dasm_put(Dst, 13914); dasm_put(Dst, 13897);
break; break;
case BC_CALLT: case BC_CALLT:
dasm_put(Dst, 13960, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); dasm_put(Dst, 13943, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
dasm_put(Dst, 14078, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); dasm_put(Dst, 14061, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break; break;
case BC_ITERC: case BC_ITERC:
dasm_put(Dst, 14148, LJ_TFUNC, 2+1, Dt7(->pc)); dasm_put(Dst, 14131, LJ_TFUNC, 2+1, Dt7(->pc));
break; break;
case BC_VARG: case BC_VARG:
dasm_put(Dst, 14228, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL); dasm_put(Dst, 14211, Dt7(->pc), PC2PROTO(numparams), (8+FRAME_VARG), LJ_TNIL);
dasm_put(Dst, 14372, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); dasm_put(Dst, 14355, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break; break;
/* -- Returns ----------------------------------------------------------- */ /* -- Returns ----------------------------------------------------------- */
case BC_RETM: case BC_RETM:
dasm_put(Dst, 13914); dasm_put(Dst, 13897);
break; break;
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, 14471); dasm_put(Dst, 14454);
} }
dasm_put(Dst, 14475, FRAME_TYPE); dasm_put(Dst, 14458, FRAME_TYPE);
switch (op) { switch (op) {
case BC_RET: case BC_RET:
dasm_put(Dst, 14494); dasm_put(Dst, 14477);
break; break;
case BC_RET1: case BC_RET1:
dasm_put(Dst, 14552); dasm_put(Dst, 14535);
/* fallthrough */ /* fallthrough */
case BC_RET0: case BC_RET0:
dasm_put(Dst, 14568); dasm_put(Dst, 14551);
default: default:
break; break;
} }
dasm_put(Dst, 14579, Dt7(->pc), PC2PROTO(k)); dasm_put(Dst, 14562, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) { if (op == BC_RET) {
dasm_put(Dst, 14621, LJ_TNIL); dasm_put(Dst, 14604, LJ_TNIL);
} else { } else {
dasm_put(Dst, 14630, LJ_TNIL); dasm_put(Dst, 14613, LJ_TNIL);
} }
dasm_put(Dst, 14637, -FRAME_VARG, FRAME_TYPEP); dasm_put(Dst, 14620, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) { if (op != BC_RET0) {
dasm_put(Dst, 14661); dasm_put(Dst, 14644);
} }
dasm_put(Dst, 4683); dasm_put(Dst, 4683);
break; break;
@ -2167,7 +2161,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, 14665, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2179,57 +2173,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, 14686); dasm_put(Dst, 14669);
if (!vk) { if (!vk) {
dasm_put(Dst, 14690, LJ_TISNUM, LJ_TISNUM); dasm_put(Dst, 14673, LJ_TISNUM, LJ_TISNUM);
} }
dasm_put(Dst, 14709); dasm_put(Dst, 14692);
if (!vk) { if (!vk) {
dasm_put(Dst, 14713, LJ_TISNUM); dasm_put(Dst, 14696, LJ_TISNUM);
} }
if (sse) { if (sse) {
dasm_put(Dst, 14722); dasm_put(Dst, 14705);
if (vk) { if (vk) {
dasm_put(Dst, 14734); dasm_put(Dst, 14717);
} else { } else {
dasm_put(Dst, 14753); dasm_put(Dst, 14736);
} }
dasm_put(Dst, 14758); dasm_put(Dst, 14741);
} else { } else {
dasm_put(Dst, 14771); dasm_put(Dst, 14754);
if (vk) { if (vk) {
dasm_put(Dst, 14777); dasm_put(Dst, 14760);
} else { } else {
dasm_put(Dst, 14793); dasm_put(Dst, 14776);
} }
dasm_put(Dst, 14801); 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, 14806); dasm_put(Dst, 14789);
} }
} }
if (op == BC_FORI) { if (op == BC_FORI) {
dasm_put(Dst, 14812, -BCBIAS_J*4); dasm_put(Dst, 14795, -BCBIAS_J*4);
} else if (op == BC_JFORI) { } else if (op == BC_JFORI) {
dasm_put(Dst, 14822, -BCBIAS_J*4, BC_JLOOP); dasm_put(Dst, 14805, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) { } else if (op == BC_IFORL) {
dasm_put(Dst, 14836, -BCBIAS_J*4); dasm_put(Dst, 14819, -BCBIAS_J*4);
} else { } else {
dasm_put(Dst, 14832, BC_JLOOP); dasm_put(Dst, 14815, BC_JLOOP);
} }
dasm_put(Dst, 10847); dasm_put(Dst, 10847);
if (sse) { if (sse) {
dasm_put(Dst, 14846); dasm_put(Dst, 14829);
} }
break; break;
case BC_ITERL: case BC_ITERL:
#if LJ_HASJIT #if LJ_HASJIT
dasm_put(Dst, 14665, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2238,18 +2232,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, 14857, LJ_TNIL); dasm_put(Dst, 14840, LJ_TNIL);
if (op == BC_JITERL) { if (op == BC_JITERL) {
dasm_put(Dst, 14872, BC_JLOOP); dasm_put(Dst, 14855, BC_JLOOP);
} else { } else {
dasm_put(Dst, 14886, -BCBIAS_J*4); dasm_put(Dst, 14869, -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, 14665, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14648, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
break; break;
@ -2259,12 +2253,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, 14902, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); dasm_put(Dst, 14885, 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, 14925, -BCBIAS_J*4); dasm_put(Dst, 14908, -BCBIAS_J*4);
break; break;
/* -- Function headers -------------------------------------------------- */ /* -- Function headers -------------------------------------------------- */
@ -2278,7 +2272,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, 14949, HOTCOUNT_PCMASK, GG_DISP2HOT); dasm_put(Dst, 14932, HOTCOUNT_PCMASK, GG_DISP2HOT);
#endif #endif
case BC_FUNCV: /* NYI: compiled vararg functions. */ case BC_FUNCV: /* NYI: compiled vararg functions. */
break; break;
@ -2288,13 +2282,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, 14970, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); dasm_put(Dst, 14953, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) { if (op == BC_JFUNCF) {
dasm_put(Dst, 15000, BC_JLOOP); dasm_put(Dst, 14983, BC_JLOOP);
} else { } else {
dasm_put(Dst, 10849); dasm_put(Dst, 10849);
} }
dasm_put(Dst, 15009, LJ_TNIL); dasm_put(Dst, 14992, LJ_TNIL);
break; break;
case BC_JFUNCV: case BC_JFUNCV:
@ -2305,30 +2299,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, 15031, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); dasm_put(Dst, 15014, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) { if (op == BC_JFUNCV) {
dasm_put(Dst, 15000, BC_JLOOP); dasm_put(Dst, 14983, BC_JLOOP);
} else { } else {
dasm_put(Dst, 15122, -4+PC2PROTO(k)); dasm_put(Dst, 15105, -4+PC2PROTO(k));
} }
dasm_put(Dst, 15144, LJ_TNIL); dasm_put(Dst, 15127, LJ_TNIL);
break; break;
case BC_FUNCC: case BC_FUNCC:
case BC_FUNCCW: case BC_FUNCCW:
dasm_put(Dst, 15166, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); dasm_put(Dst, 15149, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) { if (op == BC_FUNCC) {
dasm_put(Dst, 15195); dasm_put(Dst, 15178);
} else { } else {
dasm_put(Dst, 15182);
}
dasm_put(Dst, 15190, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) {
dasm_put(Dst, 15199); dasm_put(Dst, 15199);
}
dasm_put(Dst, 15207, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) {
dasm_put(Dst, 15216);
} else { } else {
dasm_put(Dst, 15220, DISPATCH_GL(wrapf)); dasm_put(Dst, 15203, DISPATCH_GL(wrapf));
} }
dasm_put(Dst, 15225, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); dasm_put(Dst, 15208, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break; break;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2356,7 +2350,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse); build_subroutines(ctx, cmov, sse);
dasm_put(Dst, 15250); dasm_put(Dst, 15233);
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

@ -459,7 +459,7 @@ LJLIB_CF(coroutine_status)
if (co == L) s = "running"; if (co == L) s = "running";
else if (co->status == LUA_YIELD) s = "suspended"; else if (co->status == LUA_YIELD) s = "suspended";
else if (co->status != 0) s = "dead"; else if (co->status != 0) s = "dead";
else if (co->base > co->stack+1) s = "normal"; else if (co->base > tvref(co->stack)+1) s = "normal";
else if (co->top == co->base) s = "dead"; else if (co->top == co->base) s = "dead";
else s = "suspended"; else s = "suspended";
lua_pushstring(L, s); lua_pushstring(L, s);

View File

@ -121,9 +121,9 @@ LUA_API int lua_gettop(lua_State *L)
LUA_API void lua_settop(lua_State *L, int idx) LUA_API void lua_settop(lua_State *L, int idx)
{ {
if (idx >= 0) { if (idx >= 0) {
api_check(L, idx <= L->maxstack - L->base); api_check(L, idx <= tvref(L->maxstack) - L->base);
if (L->base + idx > L->top) { if (L->base + idx > L->top) {
if (L->base + idx >= L->maxstack) if (L->base + idx >= tvref(L->maxstack))
lj_state_growstack(L, (MSize)idx - (MSize)(L->top - L->base)); lj_state_growstack(L, (MSize)idx - (MSize)(L->top - L->base));
do { setnilV(L->top++); } while (L->top < L->base + idx); do { setnilV(L->top++); } while (L->top < L->base + idx);
} else { } else {

View File

@ -319,7 +319,8 @@ static void callhook(lua_State *L, int event, BCLine line)
lj_trace_abort(g); /* Abort recording on any hook call. */ lj_trace_abort(g); /* Abort recording on any hook call. */
ar.event = event; ar.event = event;
ar.currentline = line; ar.currentline = line;
ar.i_ci = cast_int((L->base-1) - L->stack); /* Top frame, nextframe=NULL. */ /* Top frame, nextframe = NULL. */
ar.i_ci = cast_int((L->base-1) - tvref(L->stack));
lj_state_checkstack(L, 1+LUA_MINSTACK); lj_state_checkstack(L, 1+LUA_MINSTACK);
hook_enter(g); hook_enter(g);
hookf(L, &ar); hookf(L, &ar);

View File

@ -283,7 +283,7 @@ static TValue *findlocal(lua_State *L, const lua_Debug *ar,
{ {
uint32_t offset = (uint32_t)ar->i_ci & 0xffff; uint32_t offset = (uint32_t)ar->i_ci & 0xffff;
uint32_t size = (uint32_t)ar->i_ci >> 16; uint32_t size = (uint32_t)ar->i_ci >> 16;
TValue *frame = L->stack + offset; TValue *frame = tvref(L->stack) + offset;
TValue *nextframe = size ? frame + size : NULL; TValue *nextframe = size ? frame + size : NULL;
GCfunc *fn = frame_func(frame); GCfunc *fn = frame_func(frame);
BCPos pc = currentpc(L, fn, nextframe); BCPos pc = currentpc(L, fn, nextframe);
@ -335,9 +335,10 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
uint32_t offset = (uint32_t)ar->i_ci & 0xffff; uint32_t offset = (uint32_t)ar->i_ci & 0xffff;
uint32_t size = (uint32_t)ar->i_ci >> 16; uint32_t size = (uint32_t)ar->i_ci >> 16;
lua_assert(offset != 0); lua_assert(offset != 0);
frame = L->stack + offset; frame = tvref(L->stack) + offset;
if (size) nextframe = frame + size; if (size) nextframe = frame + size;
lua_assert(frame<=L->maxstack && (!nextframe || nextframe<=L->maxstack)); lua_assert(frame <= tvref(L->maxstack) &&
(!nextframe || nextframe <= tvref(L->maxstack)));
fn = frame_func(frame); fn = frame_func(frame);
lua_assert(fn->c.gct == ~LJ_TFUNC); lua_assert(fn->c.gct == ~LJ_TFUNC);
} }
@ -399,9 +400,9 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
cTValue *lj_err_getframe(lua_State *L, int level, int *size) cTValue *lj_err_getframe(lua_State *L, int level, int *size)
{ {
cTValue *frame, *nextframe; cTValue *frame, *nextframe, *bot = tvref(L->stack);
/* Traverse frames backwards. */ /* Traverse frames backwards. */
for (nextframe = frame = L->base-1; frame > L->stack; ) { for (nextframe = frame = L->base-1; frame > bot; ) {
if (frame_gc(frame) == obj2gco(L)) if (frame_gc(frame) == obj2gco(L))
level++; /* Skip dummy frames. See lj_meta_call(). */ level++; /* Skip dummy frames. See lj_meta_call(). */
if (level-- == 0) { if (level-- == 0) {
@ -426,7 +427,7 @@ LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
int size; int size;
cTValue *frame = lj_err_getframe(L, level, &size); cTValue *frame = lj_err_getframe(L, level, &size);
if (frame) { if (frame) {
ar->i_ci = (size << 16) + cast_int(frame - L->stack); ar->i_ci = (size << 16) + cast_int(frame - tvref(L->stack));
return 1; return 1;
} else { } else {
ar->i_ci = level - size; ar->i_ci = level - size;
@ -465,7 +466,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
return cf; return cf;
} }
} }
if (frame <= L->stack) if (frame <= tvref(L->stack))
break; break;
switch (frame_typep(frame)) { switch (frame_typep(frame)) {
case FRAME_LUA: /* Lua frame. */ case FRAME_LUA: /* Lua frame. */
@ -524,7 +525,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
/* No C frame. */ /* No C frame. */
if (errcode) { if (errcode) {
L->cframe = NULL; L->cframe = NULL;
L->base = L->stack+1; L->base = tvref(L->stack)+1;
unwindstack(L, L->base); unwindstack(L, L->base);
if (G(L)->panic) if (G(L)->panic)
G(L)->panic(L); G(L)->panic(L);
@ -749,9 +750,9 @@ LJ_NOINLINE void lj_err_mem(lua_State *L)
/* Find error function for runtime errors. Requires an extra stack traversal. */ /* Find error function for runtime errors. Requires an extra stack traversal. */
static ptrdiff_t finderrfunc(lua_State *L) static ptrdiff_t finderrfunc(lua_State *L)
{ {
TValue *frame = L->base-1; cTValue *frame = L->base-1, *bot = tvref(L->stack);
void *cf = L->cframe; void *cf = L->cframe;
while (frame > L->stack) { while (frame > bot) {
lua_assert(cf != NULL); lua_assert(cf != NULL);
while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */ while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */
if (frame >= restorestack(L, -cframe_nres(cf))) if (frame >= restorestack(L, -cframe_nres(cf)))

View File

@ -267,9 +267,9 @@ static void gc_traverse_proto(global_State *g, GCproto *pt)
/* Traverse the frame structure of a stack. */ /* Traverse the frame structure of a stack. */
static MSize gc_traverse_frames(global_State *g, lua_State *th) static MSize gc_traverse_frames(global_State *g, lua_State *th)
{ {
TValue *frame, *top = th->top-1; TValue *frame, *top = th->top-1, *bot = tvref(th->stack);
/* Note: extra vararg frame not skipped, marks function twice (harmless). */ /* Note: extra vararg frame not skipped, marks function twice (harmless). */
for (frame = th->base-1; frame > th->stack; frame = frame_prev(frame)) { for (frame = th->base-1; frame > bot; frame = frame_prev(frame)) {
GCfunc *fn = frame_func(frame); GCfunc *fn = frame_func(frame);
TValue *ftop = frame; TValue *ftop = frame;
if (isluafunc(fn)) ftop += funcproto(fn)->framesize; if (isluafunc(fn)) ftop += funcproto(fn)->framesize;
@ -277,18 +277,18 @@ static MSize gc_traverse_frames(global_State *g, lua_State *th)
gc_markobj(g, frame_gc(frame)); /* Need to mark hidden function (or L). */ gc_markobj(g, frame_gc(frame)); /* 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 > th->maxstack) top = th->maxstack; if (top > tvref(th->maxstack)) top = tvref(th->maxstack);
return (MSize)(top - th->stack); /* Return minimum needed stack size. */ return (MSize)(top - bot); /* Return minimum needed stack size. */
} }
/* Traverse a thread object. */ /* Traverse a thread object. */
static void gc_traverse_thread(global_State *g, lua_State *th) static void gc_traverse_thread(global_State *g, lua_State *th)
{ {
TValue *o, *top = th->top; TValue *o, *top = th->top;
for (o = th->stack+1; o < top; o++) for (o = tvref(th->stack)+1; o < top; o++)
gc_marktv(g, o); gc_marktv(g, o);
if (g->gc.state == GCSatomic) { if (g->gc.state == GCSatomic) {
top = th->stack + th->stacksize; top = tvref(th->stack) + th->stacksize;
for (; o < top; o++) /* Clear unmarked slots. */ for (; o < top; o++) /* Clear unmarked slots. */
setnilV(o); setnilV(o);
} }

View File

@ -525,8 +525,8 @@ struct lua_State {
GCRef gclist; /* GC chain. */ GCRef gclist; /* GC chain. */
TValue *base; /* Base of currently executing function. */ TValue *base; /* Base of currently executing function. */
TValue *top; /* First free slot in the stack. */ TValue *top; /* First free slot in the stack. */
TValue *maxstack; /* Last free slot in the stack. */ MRef maxstack; /* Last free slot in the stack. */
TValue *stack; /* Stack base. */ MRef stack; /* Stack base. */
GCRef openupval; /* List of open upvalues in the stack. */ GCRef openupval; /* List of open upvalues in the stack. */
GCRef env; /* Thread environment (table of globals). */ GCRef env; /* Thread environment (table of globals). */
void *cframe; /* End of C stack frame chain. */ void *cframe; /* End of C stack frame chain. */

View File

@ -1062,7 +1062,8 @@ static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val)
uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff); uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff);
if (!uvp->closed) { if (!uvp->closed) {
/* In current stack? */ /* In current stack? */
if (uvval(uvp) >= J->L->stack && uvval(uvp) < J->L->maxstack) { if (uvval(uvp) >= tvref(J->L->stack) &&
uvval(uvp) < tvref(J->L->maxstack)) {
int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot)); int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot));
if (slot >= 0) { /* Aliases an SSA slot? */ if (slot >= 0) { /* Aliases an SSA slot? */
slot -= (int32_t)J->baseslot; /* Note: slot number may be negative! */ slot -= (int32_t)J->baseslot; /* Note: slot number may be negative! */

View File

@ -231,7 +231,7 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr)
setcframe_pc(cframe_raw(L->cframe), pc+1); setcframe_pc(cframe_raw(L->cframe), pc+1);
/* Make sure the stack is big enough for the slots from the snapshot. */ /* Make sure the stack is big enough for the slots from the snapshot. */
if (LJ_UNLIKELY(L->base + nslots > L->maxstack)) { if (LJ_UNLIKELY(L->base + nslots > tvref(L->maxstack))) {
L->top = curr_topL(L); L->top = curr_topL(L);
lj_state_growstack(L, nslots - curr_proto(L)->framesize); lj_state_growstack(L, nslots - curr_proto(L)->framesize);
} }
@ -255,10 +255,10 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr)
if (isluafunc(fn)) { if (isluafunc(fn)) {
MSize framesize = funcproto(fn)->framesize; MSize framesize = funcproto(fn)->framesize;
L->base = ++o; L->base = ++o;
if (LJ_UNLIKELY(o + framesize > L->maxstack)) { /* Grow again? */ if (LJ_UNLIKELY(o + framesize > tvref(L->maxstack))) {
ptrdiff_t fsave = savestack(L, frame); ptrdiff_t fsave = savestack(L, frame);
L->top = o; L->top = o;
lj_state_growstack(L, framesize); lj_state_growstack(L, framesize); /* Grow again. */
frame = restorestack(L, fsave); frame = restorestack(L, fsave);
} }
} }

View File

@ -52,16 +52,18 @@
/* Resize stack slots and adjust pointers in state. */ /* Resize stack slots and adjust pointers in state. */
static void resizestack(lua_State *L, MSize n) static void resizestack(lua_State *L, MSize n)
{ {
TValue *st, *oldst = L->stack; TValue *st, *oldst = tvref(L->stack);
ptrdiff_t delta; ptrdiff_t delta;
MSize oldsize = L->stacksize; MSize oldsize = L->stacksize;
MSize realsize = n + 1 + LJ_STACK_EXTRA; MSize realsize = n + 1 + LJ_STACK_EXTRA;
GCobj *up; GCobj *up;
lua_assert((MSize)(L->maxstack-L->stack) == L->stacksize-LJ_STACK_EXTRA-1); lua_assert((MSize)(tvref(L->maxstack)-oldst)==L->stacksize-LJ_STACK_EXTRA-1);
lj_mem_reallocvec(L, L->stack, L->stacksize, realsize, TValue); st = (TValue *)lj_mem_realloc(L, tvref(L->stack),
st = L->stack; (MSize)(L->stacksize*sizeof(TValue)),
(MSize)(realsize*sizeof(TValue)));
setmref(L->stack, st);
delta = (char *)st - (char *)oldst; delta = (char *)st - (char *)oldst;
L->maxstack = st + n; setmref(L->maxstack, st + n);
while (oldsize < realsize) /* Clear new slots. */ while (oldsize < realsize) /* Clear new slots. */
setnilV(st + oldsize++); setnilV(st + oldsize++);
L->stacksize = realsize; L->stacksize = realsize;
@ -76,7 +78,7 @@ static void resizestack(lua_State *L, MSize n)
/* Relimit stack after error, in case the limit was overdrawn. */ /* Relimit stack after error, in case the limit was overdrawn. */
void lj_state_relimitstack(lua_State *L) void lj_state_relimitstack(lua_State *L)
{ {
if (L->stacksize > LJ_STACK_MAXEX && L->top - L->stack < LJ_STACK_MAX-1) if (L->stacksize > LJ_STACK_MAXEX && L->top-tvref(L->stack) < LJ_STACK_MAX-1)
resizestack(L, LJ_STACK_MAX); resizestack(L, LJ_STACK_MAX);
} }
@ -118,11 +120,11 @@ void LJ_FASTCALL lj_state_growstack1(lua_State *L)
/* Allocate basic stack for new state. */ /* Allocate basic stack for new state. */
static void stack_init(lua_State *L1, lua_State *L) static void stack_init(lua_State *L1, lua_State *L)
{ {
TValue *st, *stend; TValue *stend, *st = lj_mem_newvec(L, LJ_STACK_START+LJ_STACK_EXTRA, TValue);
L1->stack = st = lj_mem_newvec(L, LJ_STACK_START + LJ_STACK_EXTRA, TValue); setmref(L1->stack, st);
L1->stacksize = LJ_STACK_START + LJ_STACK_EXTRA; L1->stacksize = LJ_STACK_START + LJ_STACK_EXTRA;
stend = st + L1->stacksize; stend = st + L1->stacksize;
L1->maxstack = stend - LJ_STACK_EXTRA - 1; setmref(L1->maxstack, stend - LJ_STACK_EXTRA - 1);
L1->base = L1->top = st+1; L1->base = L1->top = st+1;
setthreadV(L1, st, L1); /* Needed for curr_funcisL() on empty stack. */ setthreadV(L1, st, L1); /* Needed for curr_funcisL() on empty stack. */
while (st < stend) /* Clear new slots. */ while (st < stend) /* Clear new slots. */
@ -162,14 +164,14 @@ static void close_state(lua_State *L)
} else } else
#endif #endif
{ {
lj_func_closeuv(L, L->stack); lj_func_closeuv(L, tvref(L->stack));
lj_gc_freeall(g); lj_gc_freeall(g);
lua_assert(gcref(g->gc.root) == obj2gco(L)); lua_assert(gcref(g->gc.root) == obj2gco(L));
lua_assert(g->strnum == 0); lua_assert(g->strnum == 0);
lj_trace_freestate(g); lj_trace_freestate(g);
lj_mem_freevec(g, g->strhash, g->strmask+1, GCRef); lj_mem_freevec(g, g->strhash, g->strmask+1, GCRef);
lj_str_freebuf(g, &g->tmpbuf); lj_str_freebuf(g, &g->tmpbuf);
lj_mem_freevec(g, L->stack, L->stacksize, TValue); lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue);
lua_assert(g->gc.total == sizeof(GG_State)); lua_assert(g->gc.total == sizeof(GG_State));
g->allocf(g->allocd, G2GG(g), sizeof(GG_State), 0); g->allocf(g->allocd, G2GG(g), sizeof(GG_State), 0);
} }
@ -234,7 +236,7 @@ LUA_API void lua_close(lua_State *L)
{ {
global_State *g = G(L); global_State *g = G(L);
L = mainthread(g); /* Only the main thread can be closed. */ L = mainthread(g); /* Only the main thread can be closed. */
lj_func_closeuv(L, L->stack); lj_func_closeuv(L, tvref(L->stack));
lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */ lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */
#if LJ_HASJIT #if LJ_HASJIT
G2J(g)->flags &= ~JIT_F_ON; G2J(g)->flags &= ~JIT_F_ON;
@ -245,7 +247,7 @@ LUA_API void lua_close(lua_State *L)
hook_enter(g); hook_enter(g);
L->status = 0; L->status = 0;
L->cframe = NULL; L->cframe = NULL;
L->base = L->top = L->stack + 1; L->base = L->top = tvref(L->stack) + 1;
} while (lj_vm_cpcall(L, NULL, NULL, cpfinalize) != 0); } while (lj_vm_cpcall(L, NULL, NULL, cpfinalize) != 0);
close_state(L); close_state(L);
} }
@ -257,7 +259,7 @@ lua_State *lj_state_new(lua_State *L)
L1->dummy_ffid = FF_C; L1->dummy_ffid = FF_C;
L1->status = 0; L1->status = 0;
L1->stacksize = 0; L1->stacksize = 0;
L1->stack = NULL; setmref(L1->stack, NULL);
L1->cframe = NULL; L1->cframe = NULL;
/* NOBARRIER: The lua_State is new (marked white). */ /* NOBARRIER: The lua_State is new (marked white). */
setgcrefnull(L1->openupval); setgcrefnull(L1->openupval);
@ -271,9 +273,9 @@ lua_State *lj_state_new(lua_State *L)
void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L) void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L)
{ {
lua_assert(L != mainthread(g)); lua_assert(L != mainthread(g));
lj_func_closeuv(L, L->stack); lj_func_closeuv(L, tvref(L->stack));
lua_assert(gcref(L->openupval) == NULL); lua_assert(gcref(L->openupval) == NULL);
lj_mem_freevec(g, L->stack, L->stacksize, TValue); lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue);
lj_mem_freet(g, L); lj_mem_freet(g, L);
} }

View File

@ -9,10 +9,10 @@
#include "lj_obj.h" #include "lj_obj.h"
#define incr_top(L) \ #define incr_top(L) \
(++L->top >= L->maxstack && (lj_state_growstack1(L), 0)) (++L->top >= tvref(L->maxstack) && (lj_state_growstack1(L), 0))
#define savestack(L, p) ((char *)(p) - (char *)L->stack) #define savestack(L, p) ((char *)(p) - mref(L->stack, char))
#define restorestack(L, n) ((TValue *)((char *)L->stack + (n))) #define restorestack(L, n) ((TValue *)(mref(L->stack, char) + (n)))
LJ_FUNC void lj_state_relimitstack(lua_State *L); LJ_FUNC void lj_state_relimitstack(lua_State *L);
LJ_FUNC void lj_state_shrinkstack(lua_State *L, MSize used); LJ_FUNC void lj_state_shrinkstack(lua_State *L, MSize used);
@ -21,7 +21,8 @@ LJ_FUNC void LJ_FASTCALL lj_state_growstack1(lua_State *L);
static LJ_AINLINE void lj_state_checkstack(lua_State *L, MSize need) static LJ_AINLINE void lj_state_checkstack(lua_State *L, MSize need)
{ {
if ((MSize)((char *)L->maxstack-(char *)L->top) <= need*(MSize)sizeof(TValue)) if ((MSize)(mref(L->maxstack, char) - (char *)L->top) <=
need*(MSize)sizeof(TValue))
lj_state_growstack(L, need); lj_state_growstack(L, need);
} }