summaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-30 15:45:11 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-30 15:45:11 -0200
commit5b8ced84b4bd5ec300d3658b2ddb48d715512732 (patch)
tree729ad9e5e144dac1a62e6c86fb2716b82ebcdb94 /opcode.c
parentdf3a81ec88cdab5afca66e550c9bd768c21963e2 (diff)
downloadlua-github-5b8ced84b4bd5ec300d3658b2ddb48d715512732.tar.gz
stack is indexed by integers, not Words, to allow bigger stack on 32 bit machines
Diffstat (limited to 'opcode.c')
-rw-r--r--opcode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/opcode.c b/opcode.c
index 25485101..d7b82c50 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio
*/
-char *rcs_opcode="$Id: opcode.c,v 3.29 1994/12/27 20:53:15 celes Exp roberto $";
+char *rcs_opcode="$Id: opcode.c,v 3.30 1994/12/28 12:55:47 roberto Exp roberto $";
#include <setjmp.h>
#include <stdio.h>
@@ -24,7 +24,7 @@ char *rcs_opcode="$Id: opcode.c,v 3.29 1994/12/27 20:53:15 celes Exp roberto $";
#define STACK_BUFFER (STACKGAP+128)
-typedef unsigned int StkId; /* index to stack elements */
+typedef int StkId; /* index to stack elements */
static Long maxstack = 0L;
static Object *stack = NULL;
@@ -103,8 +103,12 @@ static void lua_checkstack (StkId n)
StkId t;
if (stack == NULL)
lua_initstack();
+ if (maxstack >= MAX_INT)
+ lua_error("stack size overflow");
t = top-stack;
maxstack *= 2;
+ if (maxstack >= MAX_INT)
+ maxstack = MAX_INT;
stack = growvector(stack, maxstack, Object);
top = stack + t;
}