mirror of
https://github.com/lua/lua
synced 2025-01-06 01:22:06 +03:00
change to allow collector to stop when it goes to the atomic phase
(just for debugging)
This commit is contained in:
parent
623e388bb4
commit
78b941039d
33
lgc.c
33
lgc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 2.142 2013/08/05 16:58:28 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.143 2013/08/07 12:18:11 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -1009,21 +1009,22 @@ static lu_mem singlestep (lua_State *L) {
|
||||
return g->GCmemtrav;
|
||||
}
|
||||
case GCSpropagate: {
|
||||
if (g->gray) {
|
||||
lu_mem oldtrav = g->GCmemtrav;
|
||||
propagatemark(g);
|
||||
return g->GCmemtrav - oldtrav; /* memory traversed in this step */
|
||||
}
|
||||
else { /* no more `gray' objects */
|
||||
lu_mem work;
|
||||
int sw;
|
||||
g->gcstate = GCSatomic; /* finish mark phase */
|
||||
g->GCestimate = g->GCmemtrav; /* save what was counted */;
|
||||
work = atomic(L); /* add what was traversed by 'atomic' */
|
||||
g->GCestimate += work; /* estimate of total memory traversed */
|
||||
sw = entersweep(L);
|
||||
return work + sw * GCSWEEPCOST;
|
||||
}
|
||||
lu_mem oldtrav = g->GCmemtrav;
|
||||
lua_assert(g->gray);
|
||||
propagatemark(g);
|
||||
if (g->gray == NULL) /* no more `gray' objects? */
|
||||
g->gcstate = GCSatomic; /* finish propagate phase */
|
||||
return g->GCmemtrav - oldtrav; /* memory traversed in this step */
|
||||
}
|
||||
case GCSatomic: {
|
||||
lu_mem work;
|
||||
int sw;
|
||||
propagateall(g); /* make sure gray list is empty */
|
||||
g->GCestimate = g->GCmemtrav; /* save what was counted */;
|
||||
work = atomic(L); /* add what was traversed by 'atomic' */
|
||||
g->GCestimate += work; /* estimate of total memory traversed */
|
||||
sw = entersweep(L);
|
||||
return work + sw * GCSWEEPCOST;
|
||||
}
|
||||
case GCSsweepstring: {
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user