diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-10-04 16:01:53 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-10-04 16:01:53 -0300 |
commit | 5ee87acd6b920a6a122277cd817aea4cfd618671 (patch) | |
tree | 5e931c1db32c2be6378fde498ffcc5ee9dec0d6a /lparser.c | |
parent | 5d834bdf571ef3ee343b21fde2d49de1e4ea08b4 (diff) | |
download | lua-github-5ee87acd6b920a6a122277cd817aea4cfd618671.tar.gz |
small optimization for boolean constants + new format for SETLIST opcode
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.4 2004/04/30 20:13:38 roberto Exp roberto $ +** $Id: lparser.c,v 2.5 2004/05/31 18:51:50 roberto Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -475,9 +475,8 @@ static void closelistfield (FuncState *fs, struct ConsControl *cc) { luaK_exp2nextreg(fs, &cc->v); cc->v.k = VVOID; if (cc->tostore == LFIELDS_PER_FLUSH) { - luaK_codeABx(fs, OP_SETLIST, cc->t->info, cc->na-1); /* flush */ + luaK_setlist(fs, cc->t->info, cc->na, cc->tostore); /* flush */ cc->tostore = 0; /* no more items pending */ - fs->freereg = cc->t->info + 1; /* free registers */ } } @@ -486,15 +485,14 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) { if (cc->tostore == 0) return; if (hasmultret(cc->v.k)) { luaK_setmultret(fs, &cc->v); - luaK_codeABx(fs, OP_SETLISTO, cc->t->info, cc->na-1); + luaK_setlist(fs, cc->t->info, cc->na, LUA_MULTRET); cc->na--; /* do not count last expression (unknown number of elements) */ } else { if (cc->v.k != VVOID) luaK_exp2nextreg(fs, &cc->v); - luaK_codeABx(fs, OP_SETLIST, cc->t->info, cc->na-1); + luaK_setlist(fs, cc->t->info, cc->na, cc->tostore); } - fs->freereg = cc->t->info + 1; /* free registers */ } |