diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 | ||
192 | void 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 | ||