diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-04-28 16:04:36 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-04-28 16:04:36 -0300 |
commit | e091a254dfe4521d837469d3ae7cc329e2df3376 (patch) | |
tree | 7ee2f1c83a9a07500b6826bb55f0f1e977785d02 /lstate.c | |
parent | 58c3aa8b5f51194980a9abf463a2648bb1413925 (diff) | |
download | lua-e091a254dfe4521d837469d3ae7cc329e2df3376.tar.gz lua-e091a254dfe4521d837469d3ae7cc329e2df3376.tar.bz2 lua-e091a254dfe4521d837469d3ae7cc329e2df3376.zip |
new way to GC stacks: the entire stack must be correct all the times;
the 'dead' part of a stack (after the top) must have only nil's, so
that 'top' may go up without cleaning the stack.
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.52 2009/04/17 14:40:13 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.53 2009/04/17 22:00:01 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -75,9 +75,12 @@ void luaE_freeCI (lua_State *L) { | |||
75 | 75 | ||
76 | 76 | ||
77 | static void stack_init (lua_State *L1, lua_State *L) { | 77 | static void stack_init (lua_State *L1, lua_State *L) { |
78 | int i; | ||
78 | /* initialize stack array */ | 79 | /* initialize stack array */ |
79 | L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); | 80 | L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); |
80 | L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; | 81 | L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; |
82 | for (i = 0; i < BASIC_STACK_SIZE + EXTRA_STACK; i++) | ||
83 | setnilvalue(L1->stack + i); /* erase new stack */ | ||
81 | L1->top = L1->stack; | 84 | L1->top = L1->stack; |
82 | L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; | 85 | L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; |
83 | /* initialize first ci */ | 86 | /* initialize first ci */ |