corrected some places where an old object could end up in front
of a new one + minimal documentation about this problem
This commit is contained in:
9
lgc.c
9
lgc.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 2.92 2010/05/07 18:43:24 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.93 2010/05/10 16:46:49 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ void luaC_checkupvalcolor (global_State *g, UpVal *uv) {
|
||||
lua_assert(!isblack(o)); /* open upvalues are never black */
|
||||
if (isgray(o)) {
|
||||
if (keepinvariant(g)) {
|
||||
resetoldbit(o);
|
||||
resetoldbit(o); /* see MOVE OLD rule */
|
||||
gray2black(o); /* it is being visited now */
|
||||
markvalue(g, uv->v);
|
||||
}
|
||||
@@ -670,6 +670,7 @@ static Udata *udata2finalize (global_State *g) {
|
||||
u->uv.next = g->allgc; /* return it to 'allgc' list */
|
||||
g->allgc = o;
|
||||
resetbit(u->uv.marked, SEPARATED); /* mark that it is not in 'tobefnz' */
|
||||
resetoldbit(o); /* see MOVE OLD rule */
|
||||
if (!keepinvariant(g)) /* not keeping invariant? */
|
||||
makewhite(g, o); /* "sweep" object */
|
||||
return u;
|
||||
@@ -729,7 +730,6 @@ void luaC_separateudata (lua_State *L, int all) {
|
||||
p = &gch(curr)->next; /* don't bother with it */
|
||||
else {
|
||||
l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */
|
||||
resetoldbit(curr); /* may be old when 'all' is true */
|
||||
*p = gch(curr)->next; /* remove 'curr' from 'udgc' list */
|
||||
gch(curr)->next = *lastnext; /* link at the end of 'tobefnz' list */
|
||||
*lastnext = curr;
|
||||
@@ -756,7 +756,7 @@ void luaC_checkfinalizer (lua_State *L, Udata *u) {
|
||||
u->uv.next = g->udgc; /* link it in list 'udgc' */
|
||||
g->udgc = obj2gco(u);
|
||||
l_setbit(u->uv.marked, SEPARATED); /* mark it as such */
|
||||
resetoldbit(obj2gco(u));
|
||||
resetoldbit(obj2gco(u)); /* see MOVE OLD rule */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -854,7 +854,6 @@ static void atomic (lua_State *L) {
|
||||
|
||||
static l_mem singlestep (lua_State *L) {
|
||||
global_State *g = G(L);
|
||||
/*lua_checkmemory(L);*/
|
||||
switch (g->gcstate) {
|
||||
case GCSpause: {
|
||||
if (!isgenerational(g))
|
||||
|
||||
Reference in New Issue
Block a user