diff options
| -rw-r--r-- | lgc.c | 16 | ||||
| -rw-r--r-- | lgc.h | 16 | ||||
| -rw-r--r-- | lstring.c | 4 |
3 files changed, 18 insertions, 18 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.63 2009/11/26 11:39:20 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.64 2009/12/11 19:14:59 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 | */ |
| @@ -786,12 +786,12 @@ void luaC_step (lua_State *L) { | |||
| 786 | 786 | ||
| 787 | 787 | ||
| 788 | /* | 788 | /* |
| 789 | ** advances the garbage collector until it reaches a "valid" state | 789 | ** advances the garbage collector until it reaches a state allowed |
| 790 | ** (defined by the caller) | 790 | ** by 'statemask' |
| 791 | */ | 791 | */ |
| 792 | void luaC_runtilstate (lua_State *L, int validstates) { | 792 | void luaC_runtilstate (lua_State *L, int statesmask) { |
| 793 | global_State *g = G(L); | 793 | global_State *g = G(L); |
| 794 | while (!(g->gcstate & validstates)) | 794 | while (!testbit(statesmask, g->gcstate)) |
| 795 | singlestep(L); | 795 | singlestep(L); |
| 796 | } | 796 | } |
| 797 | 797 | ||
| @@ -811,13 +811,13 @@ void luaC_fullgc (lua_State *L, int isemergency) { | |||
| 811 | g->gcstate = GCSsweepstring; | 811 | g->gcstate = GCSsweepstring; |
| 812 | } | 812 | } |
| 813 | /* finish any pending sweep phase */ | 813 | /* finish any pending sweep phase */ |
| 814 | luaC_runtilstate(L, ~(GCSsweepstring | GCSsweep)); | 814 | luaC_runtilstate(L, ~bit2mask(GCSsweepstring, GCSsweep)); |
| 815 | markroot(L); /* start a new collection */ | 815 | markroot(L); /* start a new collection */ |
| 816 | /* run collector up to finalizers */ | 816 | /* run collector up to finalizers */ |
| 817 | luaC_runtilstate(L, GCSfinalize); | 817 | luaC_runtilstate(L, bitmask(GCSfinalize)); |
| 818 | g->gckind = KGC_NORMAL; | 818 | g->gckind = KGC_NORMAL; |
| 819 | if (!isemergency) /* do not run finalizers during emergency GC */ | 819 | if (!isemergency) /* do not run finalizers during emergency GC */ |
| 820 | luaC_runtilstate(L, ~GCSfinalize); | 820 | luaC_runtilstate(L, ~bitmask(GCSfinalize)); |
| 821 | g->GCthreshold = (g->totalbytes/100) * g->gcpause; | 821 | g->GCthreshold = (g->totalbytes/100) * g->gcpause; |
| 822 | } | 822 | } |
| 823 | 823 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.h,v 2.24 2009/11/26 11:39:20 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.25 2009/12/11 19:14:59 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 | */ |
| @@ -14,12 +14,12 @@ | |||
| 14 | /* | 14 | /* |
| 15 | ** Possible states of the Garbage Collector | 15 | ** Possible states of the Garbage Collector |
| 16 | */ | 16 | */ |
| 17 | #define GCSpause 1 | 17 | #define GCSpause 0 |
| 18 | #define GCSpropagate 2 | 18 | #define GCSpropagate 1 |
| 19 | #define GCSatomic 4 | 19 | #define GCSatomic 2 |
| 20 | #define GCSsweepstring 8 | 20 | #define GCSsweepstring 3 |
| 21 | #define GCSsweep 16 | 21 | #define GCSsweep 4 |
| 22 | #define GCSfinalize 32 | 22 | #define GCSfinalize 5 |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | ||
| @@ -96,7 +96,7 @@ | |||
| 96 | LUAI_FUNC void luaC_separateudata (lua_State *L, int all); | 96 | LUAI_FUNC void luaC_separateudata (lua_State *L, int all); |
| 97 | LUAI_FUNC void luaC_freeallobjects (lua_State *L); | 97 | LUAI_FUNC void luaC_freeallobjects (lua_State *L); |
| 98 | LUAI_FUNC void luaC_step (lua_State *L); | 98 | LUAI_FUNC void luaC_step (lua_State *L); |
| 99 | LUAI_FUNC void luaC_runtilstate (lua_State *L, int validstates); | 99 | LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); |
| 100 | LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); | 100 | LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); |
| 101 | LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); | 101 | LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); |
| 102 | LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); | 102 | LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 2.13 2009/04/29 17:09:41 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.14 2009/12/11 19:14:59 roberto Exp roberto $ |
| 3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -23,7 +23,7 @@ void luaS_resize (lua_State *L, int newsize) { | |||
| 23 | int i; | 23 | int i; |
| 24 | stringtable *tb = &G(L)->strt; | 24 | stringtable *tb = &G(L)->strt; |
| 25 | /* cannot resize while GC is traversing strings */ | 25 | /* cannot resize while GC is traversing strings */ |
| 26 | luaC_runtilstate(L, ~GCSsweepstring); | 26 | luaC_runtilstate(L, ~bitmask(GCSsweepstring)); |
| 27 | if (newsize > tb->size) { | 27 | if (newsize > tb->size) { |
| 28 | luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); | 28 | luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *); |
| 29 | for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL; | 29 | for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL; |
