aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-28 15:30:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-28 15:30:26 -0300
commit9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9 (patch)
tree90a993daf7e7b5eb8e92e713b084cf086b684c53
parent90972ff136f310f00b04d9e9837ee0640983b743 (diff)
downloadlua-9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9.tar.gz
lua-9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9.tar.bz2
lua-9a871dd3db1baf8c7ac3bb94f03eb1f1bc3532e9.zip
tables and userdata all go to local list, too
-rw-r--r--lgc.c6
-rw-r--r--lstate.c10
-rw-r--r--lstring.c4
-rw-r--r--ltable.c4
4 files changed, 17 insertions, 7 deletions
diff --git a/lgc.c b/lgc.c
index f905d9d5..8661fe8d 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.153 2013/08/27 18:53:35 roberto Exp roberto $ 2** $Id: lgc.c,v 2.154 2013/08/27 20:04:00 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -867,11 +867,13 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
867 g->sweepgc = sweeptolive(L, g->sweepgc, NULL); 867 g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
868 } 868 }
869 /* search for pointer pointing to 'o' */ 869 /* search for pointer pointing to 'o' */
870 for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ } 870 p = (testbit(ho->marked, LOCALMARK)) ? &g->allgc : &g->localgc;
871 for (; *p != o; p = &gch(*p)->next) { /* empty */ }
871 *p = ho->next; /* remove 'o' from 'allgc' list */ 872 *p = ho->next; /* remove 'o' from 'allgc' list */
872 ho->next = g->finobj; /* link it in list 'finobj' */ 873 ho->next = g->finobj; /* link it in list 'finobj' */
873 g->finobj = o; 874 g->finobj = o;
874 l_setbit(ho->marked, FINALIZEDBIT); /* mark it as such */ 875 l_setbit(ho->marked, FINALIZEDBIT); /* mark it as such */
876 l_setbit(ho->marked, LOCALMARK); /* not in 'localgc' anymore */
875 if (!keepinvariant(g)) /* not keeping invariant? */ 877 if (!keepinvariant(g)) /* not keeping invariant? */
876 makewhite(g, o); /* "sweep" object */ 878 makewhite(g, o); /* "sweep" object */
877 } 879 }
diff --git a/lstate.c b/lstate.c
index 4d141aec..1fe59cd3 100644
--- a/lstate.c
+++ b/lstate.c
@@ -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);
diff --git a/lstring.c b/lstring.c
index 3fb86ab2..c76b6724 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 2.31 2013/08/23 13:34:54 roberto Exp roberto $ 2** $Id: lstring.c,v 2.32 2013/08/27 20:04:00 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -213,7 +213,7 @@ Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
213 Udata *u; 213 Udata *u;
214 if (s > MAX_SIZE - sizeof(Udata)) 214 if (s > MAX_SIZE - sizeof(Udata))
215 luaM_toobig(L); 215 luaM_toobig(L);
216 u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, &G(L)->allgc, 0)->u; 216 u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
217 u->uv.len = s; 217 u->uv.len = s;
218 u->uv.metatable = NULL; 218 u->uv.metatable = NULL;
219 u->uv.env = e; 219 u->uv.env = e;
diff --git a/ltable.c b/ltable.c
index ed5d9977..f7efdc59 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.79 2013/08/18 16:12:18 roberto Exp roberto $ 2** $Id: ltable.c,v 2.80 2013/08/27 20:04:00 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -378,7 +378,7 @@ static void rehash (lua_State *L, Table *t, const TValue *ek) {
378 378
379 379
380Table *luaH_new (lua_State *L) { 380Table *luaH_new (lua_State *L) {
381 Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), &G(L)->allgc, 0)->h; 381 Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h;
382 t->metatable = NULL; 382 t->metatable = NULL;
383 t->flags = cast_byte(~0); 383 t->flags = cast_byte(~0);
384 t->array = NULL; 384 t->array = NULL;