aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lgc.c b/lgc.c
index 43927a93..a3ec58f0 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.82 2010/04/29 21:43:36 roberto Exp roberto $ 2** $Id: lgc.c,v 2.83 2010/04/30 18:37:14 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*/
@@ -265,7 +265,8 @@ static void markbeingfnz (global_State *g) {
265 GCObject *o; 265 GCObject *o;
266 for (o = g->tobefnz; o != NULL; o = gch(o)->next) { 266 for (o = g->tobefnz; o != NULL; o = gch(o)->next) {
267 lua_assert(testbit(gch(o)->marked, SEPARATED)); 267 lua_assert(testbit(gch(o)->marked, SEPARATED));
268 markobject(g, o); 268 makewhite(g, o);
269 reallymarkobject(g, o);
269 } 270 }
270} 271}
271 272
@@ -651,12 +652,15 @@ static void checkSizes (lua_State *L) {
651 652
652static Udata *udata2finalize (global_State *g) { 653static Udata *udata2finalize (global_State *g) {
653 GCObject *o = g->tobefnz; /* get first element */ 654 GCObject *o = g->tobefnz; /* get first element */
654 g->tobefnz = gch(o)->next; /* remove it from 'tobefnz' list */ 655 Udata *u = rawgco2u(o);
655 gch(o)->next = g->allgc; /* return it to 'allgc' list */ 656 lua_assert(isfinalized(&u->uv));
657 g->tobefnz = u->uv.next; /* remove it from 'tobefnz' list */
658 u->uv.next = g->allgc; /* return it to 'allgc' list */
656 g->allgc = o; 659 g->allgc = o;
657 lua_assert(isfinalized(gch(o))); 660 resetbit(u->uv.marked, SEPARATED); /* mark that it is not in 'tobefnz' */
658 resetbit(gch(o)->marked, SEPARATED); /* mark it as such */ 661 if (!keepinvariant(g)) /* not keeping invariant? */
659 return rawgco2u(o); 662 makewhite(g, o); /* "sweep" object */
663 return u;
660} 664}
661 665
662 666
@@ -833,7 +837,6 @@ static l_mem singlestep (lua_State *L) {
833 return GCSWEEPMAX*GCSWEEPCOST; 837 return GCSWEEPMAX*GCSWEEPCOST;
834 } 838 }
835 else { 839 else {
836 sweepwholelist(L, &g->tobefnz); /* sweep 'to-be-finalized' list */
837 g->sweepgc = &g->allgc; /* go to next phase */ 840 g->sweepgc = &g->allgc; /* go to next phase */
838 g->gcstate = GCSsweep; 841 g->gcstate = GCSsweep;
839 return GCSWEEPCOST; 842 return GCSWEEPCOST;