summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lua/src/lcode.c
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2015-12-13 11:23:55 +0100
committer ImJezze <jezze@gmx.net>2015-12-13 11:23:55 +0100
commit4e580a77b9da9b78aba1fec8e44b1de5a4a14aaf (patch)
treedf0e1d28daa79b9151088498a933cd1fc37c9c07 /3rdparty/lua/src/lcode.c
parent1cda42b22e591965ee69561fcf52272bd991b3b2 (diff)
parent14d5966a379e9783ba724750a5f84a72af62cadc (diff)
Merge pull request #9 from mamedev/master
Sync to base master
Diffstat (limited to '3rdparty/lua/src/lcode.c')
-rw-r--r--3rdparty/lua/src/lcode.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/3rdparty/lua/src/lcode.c b/3rdparty/lua/src/lcode.c
index 5e34624bf46..7c6918fda49 100644
--- a/3rdparty/lua/src/lcode.c
+++ b/3rdparty/lua/src/lcode.c
@@ -1,5 +1,5 @@
/*
-** $Id: lcode.c,v 2.99 2014/12/29 16:49:25 roberto Exp $
+** $Id: lcode.c,v 2.103 2015/11/19 19:16:22 roberto Exp $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -29,15 +29,15 @@
#include "lvm.h"
-/* Maximum number of registers in a Lua function */
-#define MAXREGS 250
+/* Maximum number of registers in a Lua function (must fit in 8 bits) */
+#define MAXREGS 255
#define hasjumps(e) ((e)->t != (e)->f)
static int tonumeral(expdesc *e, TValue *v) {
- if (e->t != NO_JUMP || e->f != NO_JUMP)
+ if (hasjumps(e))
return 0; /* not a numeral */
switch (e->k) {
case VKINT:
@@ -279,7 +279,8 @@ void luaK_checkstack (FuncState *fs, int n) {
int newstack = fs->freereg + n;
if (newstack > fs->f->maxstacksize) {
if (newstack >= MAXREGS)
- luaX_syntaxerror(fs->ls, "function or expression too complex");
+ luaX_syntaxerror(fs->ls,
+ "function or expression needs too many registers");
fs->f->maxstacksize = cast_byte(newstack);
}
}
@@ -573,8 +574,8 @@ int luaK_exp2RK (FuncState *fs, expdesc *e) {
case VKFLT: {
e->u.info = luaK_numberK(fs, e->u.nval);
e->k = VK;
- /* go through */
}
+ /* FALLTHROUGH */
case VK: {
vk:
if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */
@@ -793,7 +794,7 @@ static int constfolding (FuncState *fs, int op, expdesc *e1, expdesc *e2) {
static void codeexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {
lua_assert(op >= OP_ADD);
- if (op <= OP_BNOT && constfolding(fs, op - OP_ADD + LUA_OPADD, e1, e2))
+ if (op <= OP_BNOT && constfolding(fs, (op - OP_ADD) + LUA_OPADD, e1, e2))
return; /* result has been folded */
else {
int o1, o2;
@@ -815,7 +816,7 @@ static void codeexpval (FuncState *fs, OpCode op,
freeexp(fs, e1);
}
e1->u.info = luaK_codeABC(fs, op, 0, o1, o2); /* generate opcode */
- e1->k = VRELOCABLE; /* all those operations are relocable */
+ e1->k = VRELOCABLE; /* all those operations are relocatable */
luaK_fixline(fs, line);
}
}
@@ -920,11 +921,11 @@ void luaK_posfix (FuncState *fs, BinOpr op,
break;
}
case OPR_EQ: case OPR_LT: case OPR_LE: {
- codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);
+ codecomp(fs, cast(OpCode, (op - OPR_EQ) + OP_EQ), 1, e1, e2);
break;
}
case OPR_NE: case OPR_GT: case OPR_GE: {
- codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);
+ codecomp(fs, cast(OpCode, (op - OPR_NE) + OP_EQ), 0, e1, e2);
break;
}
default: lua_assert(0);