aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-11 14:52:57 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-11 14:52:57 -0200
commited9be5e1f0d4b68aa848f85744ad959d7a57c9f4 (patch)
tree595b3182d3974a1b5d72821e52c69d97e6ad5f7f /lstate.c
parent9d801f43d47967a533b399352fab63c4a62ffae7 (diff)
downloadlua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.tar.gz
lua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.tar.bz2
lua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.zip
reentrant implementation of garbage collection
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lstate.c b/lstate.c
index 35518cbc..6f66df93 100644
--- a/lstate.c
+++ b/lstate.c
@@ -59,8 +59,9 @@ static void f_luaopen (lua_State *L, void *ud) {
59 G(L)->rootproto = NULL; 59 G(L)->rootproto = NULL;
60 G(L)->rootcl = NULL; 60 G(L)->rootcl = NULL;
61 G(L)->roottable = NULL; 61 G(L)->roottable = NULL;
62 G(L)->rootudata = NULL;
63 G(L)->rootupval = NULL; 62 G(L)->rootupval = NULL;
63 G(L)->rootudata = NULL;
64 G(L)->tmudata = NULL;
64 G(L)->nblocks = sizeof(lua_State) + sizeof(global_State); 65 G(L)->nblocks = sizeof(lua_State) + sizeof(global_State);
65 luaD_init(L, so->stacksize); /* init stack */ 66 luaD_init(L, so->stacksize); /* init stack */
66 /* create default event table with a dummy table, and then close the loop */ 67 /* create default event table with a dummy table, and then close the loop */
@@ -118,6 +119,7 @@ static void close_state (lua_State *L, lua_State *OL) {
118 else if (G(L)) { /* last thread; close global state */ 119 else if (G(L)) { /* last thread; close global state */
119 if (G(L)->rootudata) /* (avoid problems with incomplete states) */ 120 if (G(L)->rootudata) /* (avoid problems with incomplete states) */
120 luaC_callallgcTM(L); /* call GC tag methods for all udata */ 121 luaC_callallgcTM(L); /* call GC tag methods for all udata */
122 lua_assert(G(L)->tmudata == NULL);
121 luaC_collect(L, 1); /* collect all elements */ 123 luaC_collect(L, 1); /* collect all elements */
122 lua_assert(G(L)->rootproto == NULL); 124 lua_assert(G(L)->rootproto == NULL);
123 lua_assert(G(L)->rootudata == NULL); 125 lua_assert(G(L)->rootudata == NULL);