From 9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 28 Aug 2013 15:30:26 -0300 Subject: tables and userdata all go to local list, too --- lstate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index 4d141aec..1fe59cd3 100644 --- a/lstate.c +++ b/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 2.106 2013/08/26 12:41:10 roberto Exp roberto $ +** $Id: lstate.c,v 2.107 2013/08/27 18:53:35 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -165,6 +165,14 @@ static void init_registry (lua_State *L, global_State *g) { sethvalue(L, &g->l_registry, registry); luaH_resize(L, registry, LUA_RIDX_LAST, 0); nolocal(obj2gco(registry)); + /* registry is the first "regular" object created by a state; move it + from 'localgc' to 'allgc' so that it act as a "sentinel" there */ + lua_assert(g->allgc == NULL && + registry->next == NULL && + g->localgc == obj2gco(registry)); + g->allgc = g->localgc; + g->localgc = NULL; + l_setbit(registry->marked, LOCALMARK); /* mark that it is not in 'localgc' */ /* registry[LUA_RIDX_MAINTHREAD] = L */ setthvalue(L, &temp, L); /* temp = L */ luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); -- cgit v1.2.3-55-g6feb