aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-20 17:03:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-20 17:03:05 -0300
commit6c283b2f4f8398322e7a9a62ec8e131852b4e015 (patch)
tree608d5b61b14dfdb91cc5cf72637e876337cffcb8 /lparser.c
parent576bded5137babb9c669ccff5aedf19ed65a7598 (diff)
downloadlua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.tar.gz
lua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.tar.bz2
lua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.zip
new simetric format for ABC instructions, to avoid exchanging operands
for `commutative' operators
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lparser.c b/lparser.c
index bca90809..8a82db68 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.190 2002/07/04 18:23:42 roberto Exp $ 2** $Id: lparser.c,v 1.191 2002/08/05 17:35:45 roberto Exp roberto $
3** Lua Parser 3** Lua Parser
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -324,7 +324,7 @@ static void open_func (LexState *ls, FuncState *fs) {
324 fs->bl = NULL; 324 fs->bl = NULL;
325 f->code = NULL; 325 f->code = NULL;
326 f->source = ls->source; 326 f->source = ls->source;
327 f->maxstacksize = 1; /* register 0 is always valid */ 327 f->maxstacksize = 2; /* registers 0/1 are always valid */
328 f->numparams = 0; /* default for main chunk */ 328 f->numparams = 0; /* default for main chunk */
329 f->is_vararg = 0; /* default for main chunk */ 329 f->is_vararg = 0; /* default for main chunk */
330} 330}
@@ -489,8 +489,8 @@ static void recfield (LexState *ls, struct ConsControl *cc) {
489 check(ls, '='); 489 check(ls, '=');
490 luaK_exp2RK(fs, &key); 490 luaK_exp2RK(fs, &key);
491 expr(ls, &val); 491 expr(ls, &val);
492 luaK_exp2anyreg(fs, &val); 492 luaK_codeABC(fs, OP_SETTABLE, cc->t->info, luaK_exp2RK(fs, &key),
493 luaK_codeABC(fs, OP_SETTABLE, val.info, cc->t->info, luaK_exp2RK(fs, &key)); 493 luaK_exp2RK(fs, &val));
494 fs->freereg = reg; /* free registers */ 494 fs->freereg = reg; /* free registers */
495} 495}
496 496
@@ -735,7 +735,7 @@ static const struct {
735 lu_byte right; /* right priority */ 735 lu_byte right; /* right priority */
736} priority[] = { /* ORDER OPR */ 736} priority[] = { /* ORDER OPR */
737 {6, 6}, {6, 6}, {7, 7}, {7, 7}, /* arithmetic */ 737 {6, 6}, {6, 6}, {7, 7}, {7, 7}, /* arithmetic */
738 {10, 9}, {5, 4}, /* power and concat (right associative) */ 738 {10, 9}, {5, 4}, /* power and concat (right associative) */
739 {3, 3}, {3, 3}, /* equality */ 739 {3, 3}, {3, 3}, /* equality */
740 {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ 740 {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */
741 {2, 2}, {1, 1} /* logical (and/or) */ 741 {2, 2}, {1, 1} /* logical (and/or) */