diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-11 14:52:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-11 14:52:57 -0200 |
commit | ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4 (patch) | |
tree | 595b3182d3974a1b5d72821e52c69d97e6ad5f7f /lstate.c | |
parent | 9d801f43d47967a533b399352fab63c4a62ffae7 (diff) | |
download | lua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.tar.gz lua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.tar.bz2 lua-ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4.zip |
reentrant implementation of garbage collection
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |