Add LJ_FR2 mode: Two-slot frame info.
This commit is contained in:
@@ -662,14 +662,14 @@ static void bcemit_method(FuncState *fs, ExpDesc *e, ExpDesc *key)
|
||||
BCReg idx, func, obj = expr_toanyreg(fs, e);
|
||||
expr_free(fs, e);
|
||||
func = fs->freereg;
|
||||
bcemit_AD(fs, BC_MOV, func+1, obj); /* Copy object to first argument. */
|
||||
bcemit_AD(fs, BC_MOV, func+1+LJ_FR2, obj); /* Copy object to 1st argument. */
|
||||
lua_assert(expr_isstrk(key));
|
||||
idx = const_str(fs, key);
|
||||
if (idx <= BCMAX_C) {
|
||||
bcreg_reserve(fs, 2);
|
||||
bcreg_reserve(fs, 2+LJ_FR2);
|
||||
bcemit_ABC(fs, BC_TGETS, func, obj, idx);
|
||||
} else {
|
||||
bcreg_reserve(fs, 3);
|
||||
bcreg_reserve(fs, 3+LJ_FR2);
|
||||
bcemit_AD(fs, BC_KSTR, func+2, idx);
|
||||
bcemit_ABC(fs, BC_TGETV, func, obj, func+2);
|
||||
fs->freereg--;
|
||||
@@ -1913,11 +1913,11 @@ static void parse_args(LexState *ls, ExpDesc *e)
|
||||
lua_assert(e->k == VNONRELOC);
|
||||
base = e->u.s.info; /* Base register for call. */
|
||||
if (args.k == VCALL) {
|
||||
ins = BCINS_ABC(BC_CALLM, base, 2, args.u.s.aux - base - 1);
|
||||
ins = BCINS_ABC(BC_CALLM, base, 2, args.u.s.aux - base - 1 - LJ_FR2);
|
||||
} else {
|
||||
if (args.k != VVOID)
|
||||
expr_tonextreg(fs, &args);
|
||||
ins = BCINS_ABC(BC_CALL, base, 2, fs->freereg - base);
|
||||
ins = BCINS_ABC(BC_CALL, base, 2, fs->freereg - base - LJ_FR2);
|
||||
}
|
||||
expr_init(e, VCALL, bcemit_INS(fs, ins));
|
||||
e->u.s.aux = base;
|
||||
@@ -1957,6 +1957,7 @@ static void expr_primary(LexState *ls, ExpDesc *v)
|
||||
parse_args(ls, v);
|
||||
} else if (ls->tok == '(' || ls->tok == TK_string || ls->tok == '{') {
|
||||
expr_tonextreg(fs, v);
|
||||
if (LJ_FR2) bcreg_reserve(fs, 1);
|
||||
parse_args(ls, v);
|
||||
} else {
|
||||
break;
|
||||
@@ -2537,7 +2538,8 @@ static void parse_for_iter(LexState *ls, GCstr *indexname)
|
||||
lex_check(ls, TK_in);
|
||||
line = ls->linenumber;
|
||||
assign_adjust(ls, 3, expr_list(ls, &e), &e);
|
||||
bcreg_bump(fs, 3); /* The iterator needs another 3 slots (func + 2 args). */
|
||||
/* The iterator needs another 3 [4] slots (func [pc] | state ctl). */
|
||||
bcreg_bump(fs, 3+LJ_FR2);
|
||||
isnext = (nvars <= 5 && predict_next(ls, fs, exprpc));
|
||||
var_add(ls, 3); /* Hidden control variables. */
|
||||
lex_check(ls, TK_do);
|
||||
|
||||
Reference in New Issue
Block a user