From a314409dba5579b3523460f4e385574fce40aeb2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 18 Jun 2018 14:58:21 -0300 Subject: [PATCH] in generational mode, an emergency collection can turn any object black during any memory allocation + 'luaT_getvarargs' may reallocate the stack, and therefore the top must be correct. --- lvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lvm.c b/lvm.c index 1e45e2ce..9e8bec0c 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.357 2018/06/01 16:51:34 roberto Exp roberto $ +** $Id: lvm.c,v 2.358 2018/06/15 14:14:20 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -712,7 +712,7 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); else /* get upvalue from enclosing function */ ncl->upvals[i] = encup[uv[i].idx]; - /* new closure is white, so we do not need a barrier here */ + luaC_objbarrier(L, ncl, ncl->upvals[i]); } if (p->cachemiss >= MAXMISS) /* too many missings? */ p->cache = NULL; /* give up cache */ @@ -1790,7 +1790,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { } vmcase(OP_VARARG) { int n = GETARG_C(i) - 1; /* required results */ - ProtectNT(luaT_getvarargs(L, ci, ra, n)); + Protect(luaT_getvarargs(L, ci, ra, n)); vmbreak; } vmcase(OP_PREPVARARG) {