Missing GC barrier in 'luaV_finishset'
This commit is contained in:
3
lapi.c
3
lapi.c
@@ -888,9 +888,8 @@ LUA_API void lua_settable (lua_State *L, int idx) {
|
|||||||
api_checkpop(L, 2);
|
api_checkpop(L, 2);
|
||||||
t = index2value(L, idx);
|
t = index2value(L, idx);
|
||||||
luaV_fastset(t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres, luaH_pset);
|
luaV_fastset(t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres, luaH_pset);
|
||||||
if (hres == HOK) {
|
if (hres == HOK)
|
||||||
luaV_finishfastset(L, t, s2v(L->top.p - 1));
|
luaV_finishfastset(L, t, s2v(L->top.p - 1));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
luaV_finishset(L, t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres);
|
luaV_finishset(L, t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres);
|
||||||
L->top.p -= 2; /* pop index and value */
|
L->top.p -= 2; /* pop index and value */
|
||||||
|
|||||||
4
lvm.c
4
lvm.c
@@ -362,8 +362,10 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
|
|||||||
}
|
}
|
||||||
t = tm; /* else repeat assignment over 'tm' */
|
t = tm; /* else repeat assignment over 'tm' */
|
||||||
luaV_fastset(t, key, val, hres, luaH_pset);
|
luaV_fastset(t, key, val, hres, luaH_pset);
|
||||||
if (hres == HOK)
|
if (hres == HOK) {
|
||||||
|
luaV_finishfastset(L, t, val);
|
||||||
return; /* done */
|
return; /* done */
|
||||||
|
}
|
||||||
/* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */
|
/* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */
|
||||||
}
|
}
|
||||||
luaG_runerror(L, "'__newindex' chain too long; possible loop");
|
luaG_runerror(L, "'__newindex' chain too long; possible loop");
|
||||||
|
|||||||
@@ -600,6 +600,21 @@ if T then
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if T then
|
||||||
|
collectgarbage("stop")
|
||||||
|
T.gcstate("pause")
|
||||||
|
local sup = {x = 0}
|
||||||
|
local a = setmetatable({}, {__newindex = sup})
|
||||||
|
T.gcstate("enteratomic")
|
||||||
|
assert(T.gccolor(sup) == "black")
|
||||||
|
a.x = {} -- should not break the invariant
|
||||||
|
assert(not (T.gccolor(sup) == "black" and T.gccolor(sup.x) == "white"))
|
||||||
|
T.gcstate("pause") -- complete the GC cycle
|
||||||
|
sup.x.y = 10
|
||||||
|
collectgarbage("restart")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if T then
|
if T then
|
||||||
print("emergency collections")
|
print("emergency collections")
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
|
|||||||
Reference in New Issue
Block a user