diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-03 14:39:48 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-03 14:39:48 -0300 |
commit | aa73403ba41f7f0992e839e5eb3dd480ef3c01a3 (patch) | |
tree | ef416ab2e316d896cc0e0abca789c5902d4b0811 | |
parent | 0c27de2e7bb93936e9a1ad84ebc1f4d99e845190 (diff) | |
download | lua-aa73403ba41f7f0992e839e5eb3dd480ef3c01a3.tar.gz lua-aa73403ba41f7f0992e839e5eb3dd480ef3c01a3.tar.bz2 lua-aa73403ba41f7f0992e839e5eb3dd480ef3c01a3.zip |
no need of a KGC_FORCED collection kind; it has the same behavior of
a normal collection
-rw-r--r-- | lgc.c | 9 | ||||
-rw-r--r-- | lstate.h | 7 |
2 files changed, 7 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.84 2010/05/03 11:55:40 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.85 2010/05/03 17:33:39 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 | */ |
@@ -899,7 +899,6 @@ static void generationalcollection (lua_State *L) { | |||
899 | static void step (lua_State *L) { | 899 | static void step (lua_State *L) { |
900 | global_State *g = G(L); | 900 | global_State *g = G(L); |
901 | l_mem lim = g->gcstepmul; /* how much to work */ | 901 | l_mem lim = g->gcstepmul; /* how much to work */ |
902 | lua_assert(g->gckind == KGC_NORMAL); | ||
903 | do { /* always perform at least one single step */ | 902 | do { /* always perform at least one single step */ |
904 | lim -= singlestep(L); | 903 | lim -= singlestep(L); |
905 | } while (lim > 0 && g->gcstate != GCSpause); | 904 | } while (lim > 0 && g->gcstate != GCSpause); |
@@ -926,10 +925,10 @@ void luaC_step (lua_State *L) { | |||
926 | void luaC_fullgc (lua_State *L, int isemergency) { | 925 | void luaC_fullgc (lua_State *L, int isemergency) { |
927 | global_State *g = G(L); | 926 | global_State *g = G(L); |
928 | int origkind = g->gckind; | 927 | int origkind = g->gckind; |
929 | lua_assert(origkind == KGC_NORMAL || origkind == KGC_GEN); | 928 | lua_assert(origkind != KGC_EMERGENCY); |
930 | if (!isemergency) /* do not run finalizers during emergency GC */ | 929 | if (!isemergency) /* do not run finalizers during emergency GC */ |
931 | callallpendingfinalizers(L, 1); | 930 | callallpendingfinalizers(L, 1); |
932 | g->gckind = isemergency ? KGC_EMERGENCY : KGC_FORCED; | 931 | g->gckind = isemergency ? KGC_EMERGENCY : KGC_NORMAL; |
933 | if (g->gcstate == GCSpropagate) { /* marking phase? */ | 932 | if (g->gcstate == GCSpropagate) { /* marking phase? */ |
934 | /* must sweep all objects to turn them back to white | 933 | /* must sweep all objects to turn them back to white |
935 | (as white has not changed, nothing will be collected) */ | 934 | (as white has not changed, nothing will be collected) */ |
@@ -945,7 +944,7 @@ void luaC_fullgc (lua_State *L, int isemergency) { | |||
945 | if (!isemergency) /* do not run finalizers during emergency GC */ | 944 | if (!isemergency) /* do not run finalizers during emergency GC */ |
946 | callallpendingfinalizers(L, 1); | 945 | callallpendingfinalizers(L, 1); |
947 | if (origkind == KGC_GEN) { /* generational mode? */ | 946 | if (origkind == KGC_GEN) { /* generational mode? */ |
948 | /* collector must be always in propagate phase */ | 947 | /* generational mode must always start in propagate phase */ |
949 | luaC_runtilstate(L, bitmask(GCSpropagate)); | 948 | luaC_runtilstate(L, bitmask(GCSpropagate)); |
950 | } | 949 | } |
951 | g->GCdebt = stddebt(g); | 950 | g->GCdebt = stddebt(g); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.63 2010/04/13 20:48:12 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.64 2010/04/29 17:31:31 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -54,9 +54,8 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
54 | 54 | ||
55 | /* kinds of Garbage Collection */ | 55 | /* kinds of Garbage Collection */ |
56 | #define KGC_NORMAL 0 | 56 | #define KGC_NORMAL 0 |
57 | #define KGC_FORCED 1 /* gc was forced by the program */ | 57 | #define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ |
58 | #define KGC_EMERGENCY 2 /* gc was forced by an allocation failure */ | 58 | #define KGC_GEN 2 /* generational collection */ |
59 | #define KGC_GEN 3 /* generational collection */ | ||
60 | 59 | ||
61 | 60 | ||
62 | typedef struct stringtable { | 61 | typedef struct stringtable { |