mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
better control when growing arrays.
This commit is contained in:
parent
9704ff4cb1
commit
9284742a11
8 changed files with 68 additions and 50 deletions
17
opcode.c
17
opcode.c
|
|
@ -3,7 +3,7 @@
|
|||
** TecCGraf - PUC-Rio
|
||||
*/
|
||||
|
||||
char *rcs_opcode="$Id: opcode.c,v 3.62 1996/03/19 22:28:37 roberto Exp roberto $";
|
||||
char *rcs_opcode="$Id: opcode.c,v 3.63 1996/03/20 17:05:44 roberto Exp roberto $";
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -93,14 +93,17 @@ static void growstack (void)
|
|||
lua_initstack();
|
||||
else
|
||||
{
|
||||
static int limit = 10000;
|
||||
StkId t = top-stack;
|
||||
Long maxstack = stackLimit - stack;
|
||||
maxstack *= 2;
|
||||
stack = growvector(stack, maxstack, Object);
|
||||
stackLimit = stack+maxstack;
|
||||
Long stacksize = stackLimit - stack;
|
||||
stacksize = growvector(&stack, stacksize, Object, stackEM, limit+100);
|
||||
stackLimit = stack+stacksize;
|
||||
top = stack + t;
|
||||
if (maxstack >= MAX_WORD/2)
|
||||
lua_error("stack size overflow");
|
||||
if (stacksize >= limit)
|
||||
{
|
||||
limit = stacksize;
|
||||
lua_error(luaI_memerrormsg[stackEM]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue