aboutsummaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-21 13:33:47 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-21 13:33:47 -0300
commit9284742a11b92dfe4ef011b963240cfa588515cd (patch)
tree96cc498fcc5ec27546fc0738998319c829df55d0 /opcode.c
parent9704ff4cb14f34077062447d15196d32ace23e95 (diff)
downloadlua-9284742a11b92dfe4ef011b963240cfa588515cd.tar.gz
lua-9284742a11b92dfe4ef011b963240cfa588515cd.tar.bz2
lua-9284742a11b92dfe4ef011b963240cfa588515cd.zip
better control when growing arrays.
Diffstat (limited to 'opcode.c')
-rw-r--r--opcode.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/opcode.c b/opcode.c
index 3b4ce09c..c7db7824 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.62 1996/03/19 22:28:37 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.63 1996/03/20 17:05:44 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -93,14 +93,17 @@ static void growstack (void)
93 lua_initstack(); 93 lua_initstack();
94 else 94 else
95 { 95 {
96 static int limit = 10000;
96 StkId t = top-stack; 97 StkId t = top-stack;
97 Long maxstack = stackLimit - stack; 98 Long stacksize = stackLimit - stack;
98 maxstack *= 2; 99 stacksize = growvector(&stack, stacksize, Object, stackEM, limit+100);
99 stack = growvector(stack, maxstack, Object); 100 stackLimit = stack+stacksize;
100 stackLimit = stack+maxstack;
101 top = stack + t; 101 top = stack + t;
102 if (maxstack >= MAX_WORD/2) 102 if (stacksize >= limit)
103 lua_error("stack size overflow"); 103 {
104 limit = stacksize;
105 lua_error(luaI_memerrormsg[stackEM]);
106 }
104 } 107 }
105} 108}
106 109