diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-13 12:46:38 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-13 12:46:38 -0200 |
commit | de3b1c9b53d74de4f22fe75b801cc57e1ba2840e (patch) | |
tree | 68b9034ce23a2a359a5f6f674dbad05e4b796e6a /lstate.c | |
parent | 733c58595bb57541e38275103fade1330aeb839d (diff) | |
download | lua-de3b1c9b53d74de4f22fe75b801cc57e1ba2840e.tar.gz lua-de3b1c9b53d74de4f22fe75b801cc57e1ba2840e.tar.bz2 lua-de3b1c9b53d74de4f22fe75b801cc57e1ba2840e.zip |
better control for number of finalizers called at each GC cycle
(increases progressively)
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.117 2014/02/11 12:18:12 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.118 2014/02/13 12:11:34 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 | */ |
@@ -214,10 +214,10 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
214 | 214 | ||
215 | 215 | ||
216 | /* | 216 | /* |
217 | ** preinitialize a state with consistent values without allocating | 217 | ** preinitialize a thread with consistent values without allocating |
218 | ** any memory (to avoid errors) | 218 | ** any memory (to avoid errors) |
219 | */ | 219 | */ |
220 | static void preinit_state (lua_State *L, global_State *g) { | 220 | static void preinit_thread (lua_State *L, global_State *g) { |
221 | G(L) = g; | 221 | G(L) = g; |
222 | L->stack = NULL; | 222 | L->stack = NULL; |
223 | L->ci = NULL; | 223 | L->ci = NULL; |
@@ -264,7 +264,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) { | |||
264 | g->mainthread->next = obj2gco(L1); | 264 | g->mainthread->next = obj2gco(L1); |
265 | setthvalue(L, L->top, L1); | 265 | setthvalue(L, L->top, L1); |
266 | api_incr_top(L); | 266 | api_incr_top(L); |
267 | preinit_state(L1, g); | 267 | preinit_thread(L1, g); |
268 | L1->hookmask = L->hookmask; | 268 | L1->hookmask = L->hookmask; |
269 | L1->basehookcount = L->basehookcount; | 269 | L1->basehookcount = L->basehookcount; |
270 | L1->hook = L->hook; | 270 | L1->hook = L->hook; |
@@ -298,8 +298,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
298 | L->tt = LUA_TTHREAD; | 298 | L->tt = LUA_TTHREAD; |
299 | g->currentwhite = bitmask(WHITE0BIT); | 299 | g->currentwhite = bitmask(WHITE0BIT); |
300 | L->marked = luaC_white(g); | 300 | L->marked = luaC_white(g); |
301 | g->gckind = KGC_NORMAL; | 301 | preinit_thread(L, g); |
302 | preinit_state(L, g); | ||
303 | g->frealloc = f; | 302 | g->frealloc = f; |
304 | g->ud = ud; | 303 | g->ud = ud; |
305 | g->mainthread = L; | 304 | g->mainthread = L; |
@@ -313,12 +312,14 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
313 | g->panic = NULL; | 312 | g->panic = NULL; |
314 | g->version = NULL; | 313 | g->version = NULL; |
315 | g->gcstate = GCSpause; | 314 | g->gcstate = GCSpause; |
315 | g->gckind = KGC_NORMAL; | ||
316 | g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; | 316 | g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; |
317 | g->sweepgc = NULL; | 317 | g->sweepgc = NULL; |
318 | g->gray = g->grayagain = NULL; | 318 | g->gray = g->grayagain = NULL; |
319 | g->weak = g->ephemeron = g->allweak = NULL; | 319 | g->weak = g->ephemeron = g->allweak = NULL; |
320 | g->totalbytes = sizeof(LG); | 320 | g->totalbytes = sizeof(LG); |
321 | g->GCdebt = 0; | 321 | g->GCdebt = 0; |
322 | g->gcfinnum = 0; | ||
322 | g->gcpause = LUAI_GCPAUSE; | 323 | g->gcpause = LUAI_GCPAUSE; |
323 | g->gcstepmul = LUAI_GCMUL; | 324 | g->gcstepmul = LUAI_GCMUL; |
324 | for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; | 325 | for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; |