diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-04 15:09:06 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-04 15:09:06 -0300 |
| commit | 3e662cec89fa928122873ff302ed2c39217d4710 (patch) | |
| tree | 464539ebde56780a3561489398f55c835d6cfbfb | |
| parent | fde866e303b3a470517931e24e4d853a627fdb08 (diff) | |
| download | lua-3e662cec89fa928122873ff302ed2c39217d4710.tar.gz lua-3e662cec89fa928122873ff302ed2c39217d4710.tar.bz2 lua-3e662cec89fa928122873ff302ed2c39217d4710.zip | |
full GC must run finalizers only after finishing everything else
(including a return to generational mode if needed)
| -rw-r--r-- | lgc.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.85 2010/05/03 17:33:39 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.86 2010/05/03 17:39:48 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 | */ |
| @@ -613,9 +613,9 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { | |||
| 613 | freeobj(L, curr); /* erase 'curr' */ | 613 | freeobj(L, curr); /* erase 'curr' */ |
| 614 | } | 614 | } |
| 615 | else { | 615 | else { |
| 616 | lua_assert(!isdead(g, curr) || testbit(gch(curr)->marked, FIXEDBIT)); | 616 | lua_assert(!isdead(g, curr) || testbit(marked, FIXEDBIT)); |
| 617 | if (gckind == KGC_GEN) { /* generational mode? */ | 617 | if (gckind == KGC_GEN) { /* generational mode? */ |
| 618 | if (testbit(gch(curr)->marked, OLDBIT)) { /* old generation? */ | 618 | if (testbit(marked, OLDBIT)) { /* old generation? */ |
| 619 | static GCObject *nullp = NULL; | 619 | static GCObject *nullp = NULL; |
| 620 | return &nullp; /* stop sweeping this list */ | 620 | return &nullp; /* stop sweeping this list */ |
| 621 | } | 621 | } |
| @@ -941,13 +941,13 @@ void luaC_fullgc (lua_State *L, int isemergency) { | |||
| 941 | luaC_runtilstate(L, ~bitmask(GCSpause)); | 941 | luaC_runtilstate(L, ~bitmask(GCSpause)); |
| 942 | luaC_runtilstate(L, bitmask(GCSpause)); | 942 | luaC_runtilstate(L, bitmask(GCSpause)); |
| 943 | g->gckind = origkind; | 943 | g->gckind = origkind; |
| 944 | if (!isemergency) /* do not run finalizers during emergency GC */ | ||
| 945 | callallpendingfinalizers(L, 1); | ||
| 946 | if (origkind == KGC_GEN) { /* generational mode? */ | 944 | if (origkind == KGC_GEN) { /* generational mode? */ |
| 947 | /* generational mode must always start in propagate phase */ | 945 | /* generational mode must always start in propagate phase */ |
| 948 | luaC_runtilstate(L, bitmask(GCSpropagate)); | 946 | luaC_runtilstate(L, bitmask(GCSpropagate)); |
| 949 | } | 947 | } |
| 950 | g->GCdebt = stddebt(g); | 948 | g->GCdebt = stddebt(g); |
| 949 | if (!isemergency) /* do not run finalizers during emergency GC */ | ||
| 950 | callallpendingfinalizers(L, 1); | ||
| 951 | } | 951 | } |
| 952 | 952 | ||
| 953 | /* }====================================================== */ | 953 | /* }====================================================== */ |
