summaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-27 15:53:35 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-27 15:53:35 -0300
commitaf35c7f398e8149b5f2481b63b399674e4ecdf7e (patch)
tree7d74f5c81bb0e2555cab4bce00a94a12a6d78604 /lvm.c
parent742b7377d38e43224ee5dda4bb83a42763c20af8 (diff)
downloadlua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.tar.gz
lua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.tar.bz2
lua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.zip
upvalues collected by reference count
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lvm.c b/lvm.c
index d29c0118..5ebeb30d 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.177 2013/08/16 18:55:49 roberto Exp roberto $ 2** $Id: lvm.c,v 2.178 2013/08/19 14:18:43 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -416,7 +416,8 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base,
416 ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx); 416 ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx);
417 else /* get upvalue from enclosing function */ 417 else /* get upvalue from enclosing function */
418 ncl->l.upvals[i] = encup[uv[i].idx]; 418 ncl->l.upvals[i] = encup[uv[i].idx];
419 /* new closure is white and local, so we do not need a barrier here */ 419 ncl->l.upvals[i]->refcount++;
420 /* new closure is white, so we do not need a barrier here */
420 } 421 }
421 if (!isblack(obj2gco(p))) /* cache will not break GC invariant? */ 422 if (!isblack(obj2gco(p))) /* cache will not break GC invariant? */
422 p->cache = ncl; /* save it on cache for reuse */ 423 p->cache = ncl; /* save it on cache for reuse */
@@ -591,7 +592,7 @@ void luaV_execute (lua_State *L) {
591 vmcase(OP_SETUPVAL, 592 vmcase(OP_SETUPVAL,
592 UpVal *uv = cl->upvals[GETARG_B(i)]; 593 UpVal *uv = cl->upvals[GETARG_B(i)];
593 setobj(L, uv->v, ra); 594 setobj(L, uv->v, ra);
594 luaC_barrier(L, uv, ra); 595 luaC_upvalbarrier(L, uv);
595 ) 596 )
596 vmcase(OP_SETTABLE, 597 vmcase(OP_SETTABLE,
597 Protect(luaV_settable(L, ra, RKB(i), RKC(i))); 598 Protect(luaV_settable(L, ra, RKB(i), RKC(i)));