summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-09-11 11:47:08 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-09-11 11:47:08 -0300
commit4eeb1831bee8c424a60b5ca05667b5d1c1bb662e (patch)
treebba7a83b633eae54c67e5797c3559d7faa04f8e1 /lgc.c
parentdd373a8f665e5e22ad3ad75401aa9fe3bbb2afc8 (diff)
downloadlua-4eeb1831bee8c424a60b5ca05667b5d1c1bb662e.tar.gz
lua-4eeb1831bee8c424a60b5ca05667b5d1c1bb662e.tar.bz2
lua-4eeb1831bee8c424a60b5ca05667b5d1c1bb662e.zip
new names and better order for GC states (sweep first lists that
can have dead objects)
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lgc.c b/lgc.c
index 355c1003..be6ca0c1 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.161 2013/09/11 13:24:55 roberto Exp roberto $ 2** $Id: lgc.c,v 2.162 2013/09/11 14:09:55 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*/
@@ -1042,7 +1042,7 @@ static void setpause (global_State *g, l_mem estimate) {
1042static int entersweep (lua_State *L) { 1042static int entersweep (lua_State *L) {
1043 global_State *g = G(L); 1043 global_State *g = G(L);
1044 int n = 0; 1044 int n = 0;
1045 g->gcstate = GCSsweeplocal; 1045 g->gcstate = GCSswplocalgc;
1046 lua_assert(g->sweepgc == NULL); 1046 lua_assert(g->sweepgc == NULL);
1047 g->sweepgc = sweeptolive(L, &g->localgc, &n); 1047 g->sweepgc = sweeptolive(L, &g->localgc, &n);
1048 if (g->sweepgc == NULL) /* no live objects in local list? */ 1048 if (g->sweepgc == NULL) /* no live objects in local list? */
@@ -1151,25 +1151,25 @@ static lu_mem singlestep (lua_State *L) {
1151 sw = entersweep(L); 1151 sw = entersweep(L);
1152 return work + sw * GCSWEEPCOST; 1152 return work + sw * GCSWEEPCOST;
1153 } 1153 }
1154 case GCSsweeplocal: { 1154 case GCSswplocalgc: { /* sweep local objects */
1155 return sweepstep(L, g, GCSsweeplocfin, &g->localfin); 1155 return sweepstep(L, g, GCSswpallgc, &g->allgc);
1156 } 1156 }
1157 case GCSsweeplocfin: { 1157 case GCSswpallgc: { /* sweep non-local objects */
1158 return sweepstep(L, g, GCSsweepfin, &g->finobj); 1158 return sweepstep(L, g, GCSswpthreads, &g->mainthread->next);
1159 } 1159 }
1160 case GCSsweepfin: { 1160 case GCSswpthreads: { /* sweep threads */
1161 return sweepstep(L, g, GCSsweepall, &g->allgc); 1161 return sweepstep(L, g, GCSswplocalfin, &g->localfin);
1162 } 1162 }
1163 case GCSsweepall: { 1163 case GCSswplocalfin: { /* sweep local objects with finalizers */
1164 return sweepstep(L, g, GCSsweeptobefnz, &g->tobefnz); 1164 return sweepstep(L, g, GCSswpfinobj, &g->finobj);
1165 } 1165 }
1166 case GCSsweeptobefnz: { 1166 case GCSswpfinobj: { /* sweep non-local objects with finalizers */
1167 return sweepstep(L, g, GCSsweepthreads, &g->mainthread->next); 1167 return sweepstep(L, g, GCSswptobefnz, &g->tobefnz);
1168 } 1168 }
1169 case GCSsweepthreads: { 1169 case GCSswptobefnz: { /* sweep objects to be finalized */
1170 return sweepstep(L, g, GCSsweepend, NULL); 1170 return sweepstep(L, g, GCSswpend, NULL);
1171 } 1171 }
1172 case GCSsweepend: { 1172 case GCSswpend: { /* finish sweeps */
1173 makewhite(g, obj2gco(g->mainthread)); /* sweep main thread */ 1173 makewhite(g, obj2gco(g->mainthread)); /* sweep main thread */
1174 checkBuffer(L); 1174 checkBuffer(L);
1175 g->gcstate = GCSpause; /* finish collection */ 1175 g->gcstate = GCSpause; /* finish collection */