diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.106 2013/08/26 12:41:10 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.107 2013/08/27 18:53:35 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 | */ |
@@ -165,6 +165,14 @@ static void init_registry (lua_State *L, global_State *g) { | |||
165 | sethvalue(L, &g->l_registry, registry); | 165 | sethvalue(L, &g->l_registry, registry); |
166 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); | 166 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); |
167 | nolocal(obj2gco(registry)); | 167 | nolocal(obj2gco(registry)); |
168 | /* registry is the first "regular" object created by a state; move it | ||
169 | from 'localgc' to 'allgc' so that it act as a "sentinel" there */ | ||
170 | lua_assert(g->allgc == NULL && | ||
171 | registry->next == NULL && | ||
172 | g->localgc == obj2gco(registry)); | ||
173 | g->allgc = g->localgc; | ||
174 | g->localgc = NULL; | ||
175 | l_setbit(registry->marked, LOCALMARK); /* mark that it is not in 'localgc' */ | ||
168 | /* registry[LUA_RIDX_MAINTHREAD] = L */ | 176 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
169 | setthvalue(L, &temp, L); /* temp = L */ | 177 | setthvalue(L, &temp, L); /* temp = L */ |
170 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); | 178 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); |