diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-04-02 14:38:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-04-02 14:38:54 -0300 |
commit | a4d3080fe3d07af9d2d3124b8f49eadda7c21b44 (patch) | |
tree | e90941e2268f10ac4f7234f13efdbf85f5277e99 /lcode.c | |
parent | 5627d51e0576887c4133f5b77b1dfb67334b3115 (diff) | |
download | lua-a4d3080fe3d07af9d2d3124b8f49eadda7c21b44.tar.gz lua-a4d3080fe3d07af9d2d3124b8f49eadda7c21b44.tar.bz2 lua-a4d3080fe3d07af9d2d3124b8f49eadda7c21b44.zip |
SETLIST extra argument now is an "instruction" (OP_EXTRAARG)
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.33 2007/03/27 14:11:38 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.34 2007/05/04 18:41:49 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -824,16 +824,24 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { | |||
824 | } | 824 | } |
825 | 825 | ||
826 | 826 | ||
827 | static int luaK_codeAx (FuncState *fs, OpCode o, int a) { | ||
828 | lua_assert(getOpMode(o) == iAx); | ||
829 | return luaK_code(fs, CREATE_Ax(o, a)); | ||
830 | } | ||
831 | |||
832 | |||
827 | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { | 833 | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { |
828 | int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; | 834 | int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; |
829 | int b = (tostore == LUA_MULTRET) ? 0 : tostore; | 835 | int b = (tostore == LUA_MULTRET) ? 0 : tostore; |
830 | lua_assert(tostore != 0); | 836 | lua_assert(tostore != 0); |
831 | if (c <= MAXARG_C) | 837 | if (c <= MAXARG_C) |
832 | luaK_codeABC(fs, OP_SETLIST, base, b, c); | 838 | luaK_codeABC(fs, OP_SETLIST, base, b, c); |
833 | else { | 839 | else if (c <= MAXARG_Ax) { |
834 | luaK_codeABC(fs, OP_SETLIST, base, b, 0); | 840 | luaK_codeABC(fs, OP_SETLIST, base, b, 0); |
835 | luaK_code(fs, cast(Instruction, c)); | 841 | luaK_codeAx(fs, OP_EXTRAARG, c); |
836 | } | 842 | } |
843 | else | ||
844 | luaX_syntaxerror(fs->ls, "constructor too long"); | ||
837 | fs->freereg = base + 1; /* free registers with list values */ | 845 | fs->freereg = base + 1; /* free registers with list values */ |
838 | } | 846 | } |
839 | 847 | ||