diff options
| -rw-r--r-- | lgc.c | 11 |
1 files changed, 7 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.129 2012/05/28 20:41:00 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.130 2012/05/29 17:52:17 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 | */ |
| @@ -864,10 +864,11 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { | |||
| 864 | else { /* move 'o' to 'finobj' list */ | 864 | else { /* move 'o' to 'finobj' list */ |
| 865 | GCObject **p; | 865 | GCObject **p; |
| 866 | GCheader *ho = gch(o); | 866 | GCheader *ho = gch(o); |
| 867 | lua_assert(!isdead(g, o)); | ||
| 867 | /* avoid removing current sweep object */ | 868 | /* avoid removing current sweep object */ |
| 868 | if (g->sweepgc == &ho->next) { | 869 | if (g->sweepgc == &ho->next) { |
| 869 | /* step to next object in the list */ | 870 | /* step to next object in the list */ |
| 870 | g->sweepgc = (ho->next == NULL) ? NULL : &gch(ho->next)->next; | 871 | g->sweepgc = sweeplist(L, g->sweepgc, 1); |
| 871 | } | 872 | } |
| 872 | /* search for pointer pointing to 'o' */ | 873 | /* search for pointer pointing to 'o' */ |
| 873 | for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ } | 874 | for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ } |
| @@ -875,7 +876,10 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { | |||
| 875 | ho->next = g->finobj; /* link it in list 'finobj' */ | 876 | ho->next = g->finobj; /* link it in list 'finobj' */ |
| 876 | g->finobj = o; | 877 | g->finobj = o; |
| 877 | l_setbit(ho->marked, SEPARATED); /* mark it as such */ | 878 | l_setbit(ho->marked, SEPARATED); /* mark it as such */ |
| 878 | resetoldbit(o); /* see MOVE OLD rule */ | 879 | if (!keepinvariant(g)) /* not keeping invariant? */ |
| 880 | makewhite(g, o); /* "sweep" object */ | ||
| 881 | else | ||
| 882 | resetoldbit(o); /* see MOVE OLD rule */ | ||
| 879 | } | 883 | } |
| 880 | } | 884 | } |
| 881 | 885 | ||
| @@ -996,7 +1000,6 @@ static l_mem atomic (lua_State *L) { | |||
| 996 | clearvalues(g, g->allweak, origall); | 1000 | clearvalues(g, g->allweak, origall); |
| 997 | g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ | 1001 | g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ |
| 998 | entersweep(L); /* prepare to sweep strings */ | 1002 | entersweep(L); /* prepare to sweep strings */ |
| 999 | /*lua_checkmemory(L);*/ | ||
| 1000 | return trav; /* estimate of the objects marked by 'atomic' */ | 1003 | return trav; /* estimate of the objects marked by 'atomic' */ |
| 1001 | } | 1004 | } |
| 1002 | 1005 | ||
