From 2376eb634751f92e6bcb9dc8dbc1ef88b9873319 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 4 May 2017 10:32:01 -0300 Subject: barrier for prototype's cache (with new gray list 'protogray' to keep prototypes to have their caches visited again) + constant 'MAXMISS' --- lvm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index 744ca6dd..28833458 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.274 2017/04/28 20:57:45 roberto Exp roberto $ +** $Id: lvm.c,v 2.275 2017/04/30 20:43:26 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -626,9 +626,7 @@ static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { /* ** create a new Lua closure, push it in the stack, and initialize -** its upvalues. Note that the closure is not cached if prototype is -** already black (which means that 'cache' was already cleared by the -** GC). +** its upvalues. ??? */ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra) { @@ -645,11 +643,11 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, ncl->upvals[i] = encup[uv[i].idx]; /* new closure is white, so we do not need a barrier here */ } - if (p->cachemiss >= 10) /* too many missings? */ + if (p->cachemiss >= MAXMISS) /* too many missings? */ p->cache = NULL; /* give up cache */ else { - if (!isblack(p)) /* cache will not break GC invariant? */ - p->cache = ncl; /* save it on cache for reuse */ + p->cache = ncl; /* save it on cache for reuse */ + luaC_protobarrier(L, p, ncl); p->cachemiss++; } } -- cgit v1.2.3-55-g6feb