aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-21 17:09:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-21 17:09:51 -0300
commit0df6635711230ab306710056f621b6da59fac5ea (patch)
treed8ae245fc35157219a54407d9af6a52b42922ce1 /lgc.c
parentae800656c9f82b54f6fae1497022d3484ad0c920 (diff)
downloadlua-0df6635711230ab306710056f621b6da59fac5ea.tar.gz
lua-0df6635711230ab306710056f621b6da59fac5ea.tar.bz2
lua-0df6635711230ab306710056f621b6da59fac5ea.zip
"fixed" objects kept in a separated list (instead of being kept in
'allgc' list with a bit marking them)
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index 84741565..fddc43cf 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.148 2013/08/20 17:46:34 roberto Exp roberto $ 2** $Id: lgc.c,v 2.149 2013/08/21 19:21:16 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*/
@@ -189,6 +189,16 @@ void luaC_checkupvalcolor (global_State *g, UpVal *uv) {
189} 189}
190 190
191 191
192void luaC_fix (lua_State *L, GCObject *o) {
193 global_State *g = G(L);
194 lua_assert(g->allgc == o);
195 white2gray(o);
196 g->allgc = o->gch.next; /* remove object from 'allgc' list */
197 o->gch.next = g->fixedgc; /* link it to 'fixedgc' list */
198 g->fixedgc = o;
199}
200
201
192/* 202/*
193** create a new collectable object (with given type and size) and link 203** create a new collectable object (with given type and size) and link
194** it to '*list'. 'offset' tells how many bytes to allocate before the 204** it to '*list'. 'offset' tells how many bytes to allocate before the
@@ -927,6 +937,7 @@ void luaC_freeallobjects (lua_State *L) {
927 g->gckind = KGC_NORMAL; 937 g->gckind = KGC_NORMAL;
928 sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */ 938 sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */
929 sweepwholelist(L, &g->allgc); 939 sweepwholelist(L, &g->allgc);
940 sweepwholelist(L, &g->fixedgc); /* collect fixed objects */
930 lua_assert(g->strt.nuse == 0); 941 lua_assert(g->strt.nuse == 0);
931} 942}
932 943