mirror of https://github.com/rusefi/lua.git
registry and global table may be changed through the API without a
write barrier, so GC should visit them in the atomic phase.
This commit is contained in:
parent
2583bac3d3
commit
88eb901f81
5
lapi.c
5
lapi.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.96 2009/11/05 17:26:00 roberto Exp roberto $
|
** $Id: lapi.c,v 2.97 2009/11/06 17:03:37 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -199,7 +199,8 @@ static void moveto (lua_State *L, TValue *fr, int idx) {
|
||||||
if (idx < LUA_GLOBALSINDEX) /* function upvalue? */
|
if (idx < LUA_GLOBALSINDEX) /* function upvalue? */
|
||||||
luaC_barrier(L, curr_func(L), fr);
|
luaC_barrier(L, curr_func(L), fr);
|
||||||
}
|
}
|
||||||
/* LUA_GLOBALSINDEX does not need gc barrier (threads are never black) */
|
/* LUA_GLOBALSINDEX and LUA_REGISTRYINDEX do not need gc barrier
|
||||||
|
(collector revisits them before finishing collection) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
5
lgc.c
5
lgc.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lgc.c,v 2.59 2009/11/05 17:43:54 roberto Exp roberto $
|
** $Id: lgc.c,v 2.60 2009/11/06 17:06:19 roberto Exp roberto $
|
||||||
** Garbage Collector
|
** Garbage Collector
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -709,6 +709,9 @@ void luaC_freeall (lua_State *L) {
|
||||||
static void atomic (lua_State *L) {
|
static void atomic (lua_State *L) {
|
||||||
global_State *g = G(L);
|
global_State *g = G(L);
|
||||||
size_t udsize; /* total size of userdata to be finalized */
|
size_t udsize; /* total size of userdata to be finalized */
|
||||||
|
/* global table and registry may be changed by API */
|
||||||
|
markvalue(g, &g->l_gt);
|
||||||
|
markvalue(g, &g->l_registry);
|
||||||
/* remark occasional upvalues of (maybe) dead threads */
|
/* remark occasional upvalues of (maybe) dead threads */
|
||||||
g->gcstate = GCSatomic;
|
g->gcstate = GCSatomic;
|
||||||
remarkupvals(g);
|
remarkupvals(g);
|
||||||
|
|
Loading…
Reference in New Issue