diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-09 16:29:21 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-09 16:29:21 -0200 |
| commit | 88eb901f81d647714d14b6f7e7c6455b46a27daa (patch) | |
| tree | 3b37badf9c1d6d130a467ad586a816649984e6c7 | |
| parent | 2583bac3d3dbbe8e5f532c93f33e2c9358b850c1 (diff) | |
| download | lua-88eb901f81d647714d14b6f7e7c6455b46a27daa.tar.gz lua-88eb901f81d647714d14b6f7e7c6455b46a27daa.tar.bz2 lua-88eb901f81d647714d14b6f7e7c6455b46a27daa.zip | |
registry and global table may be changed through the API without a
write barrier, so GC should visit them in the atomic phase.
| -rw-r--r-- | lapi.c | 5 | ||||
| -rw-r--r-- | lgc.c | 5 |
2 files changed, 7 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.96 2009/11/05 17:26:00 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.97 2009/11/06 17:03:37 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -199,7 +199,8 @@ static void moveto (lua_State *L, TValue *fr, int idx) { | |||
| 199 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ | 199 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ |
| 200 | luaC_barrier(L, curr_func(L), fr); | 200 | luaC_barrier(L, curr_func(L), fr); |
| 201 | } | 201 | } |
| 202 | /* LUA_GLOBALSINDEX does not need gc barrier (threads are never black) */ | 202 | /* LUA_GLOBALSINDEX and LUA_REGISTRYINDEX do not need gc barrier |
| 203 | (collector revisits them before finishing collection) */ | ||
| 203 | } | 204 | } |
| 204 | 205 | ||
| 205 | 206 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.59 2009/11/05 17:43:54 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.60 2009/11/06 17:06:19 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 | */ |
| @@ -709,6 +709,9 @@ void luaC_freeall (lua_State *L) { | |||
| 709 | static void atomic (lua_State *L) { | 709 | static void atomic (lua_State *L) { |
| 710 | global_State *g = G(L); | 710 | global_State *g = G(L); |
| 711 | size_t udsize; /* total size of userdata to be finalized */ | 711 | size_t udsize; /* total size of userdata to be finalized */ |
| 712 | /* global table and registry may be changed by API */ | ||
| 713 | markvalue(g, &g->l_gt); | ||
| 714 | markvalue(g, &g->l_registry); | ||
| 712 | /* remark occasional upvalues of (maybe) dead threads */ | 715 | /* remark occasional upvalues of (maybe) dead threads */ |
| 713 | g->gcstate = GCSatomic; | 716 | g->gcstate = GCSatomic; |
| 714 | remarkupvals(g); | 717 | remarkupvals(g); |
