diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.116 2013/11/08 17:34:22 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.117 2014/02/11 12:18:12 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 | */ |
@@ -30,10 +30,6 @@ | |||
30 | #define LUAI_GCPAUSE 200 /* 200% */ | 30 | #define LUAI_GCPAUSE 200 /* 200% */ |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #if !defined(LUAI_GCLOCALPAUSE) | ||
34 | #define LUAI_GCLOCALPAUSE (1000 * sizeof(TString)) | ||
35 | #endif | ||
36 | |||
37 | #if !defined(LUAI_GCMUL) | 33 | #if !defined(LUAI_GCMUL) |
38 | #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ | 34 | #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ |
39 | #endif | 35 | #endif |
@@ -187,14 +183,12 @@ static void init_registry (lua_State *L, global_State *g) { | |||
187 | Table *registry = luaH_new(L); | 183 | Table *registry = luaH_new(L); |
188 | sethvalue(L, &g->l_registry, registry); | 184 | sethvalue(L, &g->l_registry, registry); |
189 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); | 185 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); |
190 | nolocal(obj2gco(registry)); | ||
191 | /* registry[LUA_RIDX_MAINTHREAD] = L */ | 186 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
192 | setthvalue(L, &temp, L); /* temp = L */ | 187 | setthvalue(L, &temp, L); /* temp = L */ |
193 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); | 188 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); |
194 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ | 189 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ |
195 | sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ | 190 | sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ |
196 | luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); | 191 | luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); |
197 | valnolocal(&temp); /* keep local invariant */ | ||
198 | } | 192 | } |
199 | 193 | ||
200 | 194 | ||
@@ -263,7 +257,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) { | |||
263 | luaC_checkGC(L); | 257 | luaC_checkGC(L); |
264 | /* create new thread */ | 258 | /* create new thread */ |
265 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; | 259 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; |
266 | L1->marked = luaC_white(g) | bit2mask(NOLOCALBIT, LOCALMARK); | 260 | L1->marked = luaC_white(g); |
267 | L1->tt = LUA_TTHREAD; | 261 | L1->tt = LUA_TTHREAD; |
268 | /* link it on list of threads */ | 262 | /* link it on list of threads */ |
269 | L1->next = g->mainthread->next; | 263 | L1->next = g->mainthread->next; |
@@ -303,7 +297,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
303 | L->next = NULL; | 297 | L->next = NULL; |
304 | L->tt = LUA_TTHREAD; | 298 | L->tt = LUA_TTHREAD; |
305 | g->currentwhite = bitmask(WHITE0BIT); | 299 | g->currentwhite = bitmask(WHITE0BIT); |
306 | L->marked = luaC_white(g) | bit2mask(NOLOCALBIT, LOCALMARK); | 300 | L->marked = luaC_white(g); |
307 | g->gckind = KGC_NORMAL; | 301 | g->gckind = KGC_NORMAL; |
308 | preinit_state(L, g); | 302 | preinit_state(L, g); |
309 | g->frealloc = f; | 303 | g->frealloc = f; |
@@ -312,7 +306,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
312 | g->seed = makeseed(L); | 306 | g->seed = makeseed(L); |
313 | g->gcrunning = 0; /* no GC while building state */ | 307 | g->gcrunning = 0; /* no GC while building state */ |
314 | g->GCestimate = 0; | 308 | g->GCestimate = 0; |
315 | g->GCthreshold = 10000; | ||
316 | g->strt.size = g->strt.nuse = 0; | 309 | g->strt.size = g->strt.nuse = 0; |
317 | g->strt.hash = NULL; | 310 | g->strt.hash = NULL; |
318 | setnilvalue(&g->l_registry); | 311 | setnilvalue(&g->l_registry); |
@@ -320,16 +313,13 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
320 | g->panic = NULL; | 313 | g->panic = NULL; |
321 | g->version = NULL; | 314 | g->version = NULL; |
322 | g->gcstate = GCSpause; | 315 | g->gcstate = GCSpause; |
323 | g->localgc = g->allgc = g->finobj = NULL; | 316 | g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; |
324 | g->tobefnz = NULL; | ||
325 | g->fixedgc = NULL; | ||
326 | g->sweepgc = NULL; | 317 | g->sweepgc = NULL; |
327 | g->gray = g->grayagain = NULL; | 318 | g->gray = g->grayagain = NULL; |
328 | g->weak = g->ephemeron = g->allweak = NULL; | 319 | g->weak = g->ephemeron = g->allweak = NULL; |
329 | g->totalbytes = sizeof(LG); | 320 | g->totalbytes = sizeof(LG); |
330 | g->GCdebt = 0; | 321 | g->GCdebt = 0; |
331 | g->gcpause = LUAI_GCPAUSE; | 322 | g->gcpause = LUAI_GCPAUSE; |
332 | g->gclocalpause = LUAI_GCLOCALPAUSE; | ||
333 | g->gcstepmul = LUAI_GCMUL; | 323 | g->gcstepmul = LUAI_GCMUL; |
334 | for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; | 324 | for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; |
335 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { | 325 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { |