summaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-04-02 14:38:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2008-04-02 14:38:54 -0300
commita4d3080fe3d07af9d2d3124b8f49eadda7c21b44 (patch)
treee90941e2268f10ac4f7234f13efdbf85f5277e99 /lcode.c
parent5627d51e0576887c4133f5b77b1dfb67334b3115 (diff)
downloadlua-github-a4d3080fe3d07af9d2d3124b8f49eadda7c21b44.tar.gz
SETLIST extra argument now is an "instruction" (OP_EXTRAARG)
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lcode.c b/lcode.c
index 853cffe2..96ef6b96 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
/*
-** $Id: lcode.c,v 2.33 2007/03/27 14:11:38 roberto Exp roberto $
+** $Id: lcode.c,v 2.34 2007/05/04 18:41:49 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -824,16 +824,24 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
}
+static int luaK_codeAx (FuncState *fs, OpCode o, int a) {
+ lua_assert(getOpMode(o) == iAx);
+ return luaK_code(fs, CREATE_Ax(o, a));
+}
+
+
void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
int b = (tostore == LUA_MULTRET) ? 0 : tostore;
lua_assert(tostore != 0);
if (c <= MAXARG_C)
luaK_codeABC(fs, OP_SETLIST, base, b, c);
- else {
+ else if (c <= MAXARG_Ax) {
luaK_codeABC(fs, OP_SETLIST, base, b, 0);
- luaK_code(fs, cast(Instruction, c));
+ luaK_codeAx(fs, OP_EXTRAARG, c);
}
+ else
+ luaX_syntaxerror(fs->ls, "constructor too long");
fs->freereg = base + 1; /* free registers with list values */
}