From 6c283b2f4f8398322e7a9a62ec8e131852b4e015 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 Aug 2002 17:03:05 -0300 Subject: new simetric format for ABC instructions, to avoid exchanging operands for `commutative' operators --- lparser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index bca90809..8a82db68 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 1.190 2002/07/04 18:23:42 roberto Exp $ +** $Id: lparser.c,v 1.191 2002/08/05 17:35:45 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -324,7 +324,7 @@ static void open_func (LexState *ls, FuncState *fs) { fs->bl = NULL; f->code = NULL; f->source = ls->source; - f->maxstacksize = 1; /* register 0 is always valid */ + f->maxstacksize = 2; /* registers 0/1 are always valid */ f->numparams = 0; /* default for main chunk */ f->is_vararg = 0; /* default for main chunk */ } @@ -489,8 +489,8 @@ static void recfield (LexState *ls, struct ConsControl *cc) { check(ls, '='); luaK_exp2RK(fs, &key); expr(ls, &val); - luaK_exp2anyreg(fs, &val); - luaK_codeABC(fs, OP_SETTABLE, val.info, cc->t->info, luaK_exp2RK(fs, &key)); + luaK_codeABC(fs, OP_SETTABLE, cc->t->info, luaK_exp2RK(fs, &key), + luaK_exp2RK(fs, &val)); fs->freereg = reg; /* free registers */ } @@ -735,7 +735,7 @@ static const struct { lu_byte right; /* right priority */ } priority[] = { /* ORDER OPR */ {6, 6}, {6, 6}, {7, 7}, {7, 7}, /* arithmetic */ - {10, 9}, {5, 4}, /* power and concat (right associative) */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ {3, 3}, {3, 3}, /* equality */ {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ {2, 2}, {1, 1} /* logical (and/or) */ -- cgit v1.2.3-55-g6feb