mirror of https://github.com/rusefi/lua.git
tables and userdata all go to local list, too
This commit is contained in:
parent
90972ff136
commit
9a871dd3db
6
lgc.c
6
lgc.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lgc.c,v 2.153 2013/08/27 18:53:35 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.154 2013/08/27 20:04:00 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -867,11 +867,13 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
|
|||
g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
|
||||
}
|
||||
/* search for pointer pointing to 'o' */
|
||||
for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
|
||||
p = (testbit(ho->marked, LOCALMARK)) ? &g->allgc : &g->localgc;
|
||||
for (; *p != o; p = &gch(*p)->next) { /* empty */ }
|
||||
*p = ho->next; /* remove 'o' from 'allgc' list */
|
||||
ho->next = g->finobj; /* link it in list 'finobj' */
|
||||
g->finobj = o;
|
||||
l_setbit(ho->marked, FINALIZEDBIT); /* mark it as such */
|
||||
l_setbit(ho->marked, LOCALMARK); /* not in 'localgc' anymore */
|
||||
if (!keepinvariant(g)) /* not keeping invariant? */
|
||||
makewhite(g, o); /* "sweep" object */
|
||||
}
|
||||
|
|
10
lstate.c
10
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);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lstring.c,v 2.31 2013/08/23 13:34:54 roberto Exp roberto $
|
||||
** $Id: lstring.c,v 2.32 2013/08/27 20:04:00 roberto Exp roberto $
|
||||
** String table (keeps all strings handled by Lua)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -213,7 +213,7 @@ Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
|
|||
Udata *u;
|
||||
if (s > MAX_SIZE - sizeof(Udata))
|
||||
luaM_toobig(L);
|
||||
u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, &G(L)->allgc, 0)->u;
|
||||
u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
|
||||
u->uv.len = s;
|
||||
u->uv.metatable = NULL;
|
||||
u->uv.env = e;
|
||||
|
|
4
ltable.c
4
ltable.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ltable.c,v 2.79 2013/08/18 16:12:18 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 2.80 2013/08/27 20:04:00 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -378,7 +378,7 @@ static void rehash (lua_State *L, Table *t, const TValue *ek) {
|
|||
|
||||
|
||||
Table *luaH_new (lua_State *L) {
|
||||
Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), &G(L)->allgc, 0)->h;
|
||||
Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h;
|
||||
t->metatable = NULL;
|
||||
t->flags = cast_byte(~0);
|
||||
t->array = NULL;
|
||||
|
|
Loading…
Reference in New Issue