diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-19 11:18:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-19 11:18:43 -0300 |
commit | 9eff921f8fe689794308cdb3fa7bb214604f75d3 (patch) | |
tree | 1aeb916a4d2f6599cd1631c7be232379bbff16c1 /lvm.c | |
parent | 8e6b7ef9ab226b9184d300ad1b14c3812a6e86d8 (diff) | |
download | lua-9eff921f8fe689794308cdb3fa7bb214604f75d3.tar.gz lua-9eff921f8fe689794308cdb3fa7bb214604f75d3.tar.bz2 lua-9eff921f8fe689794308cdb3fa7bb214604f75d3.zip |
"barrier" for link prototype->cache changed to be consistent with
GC behavior (link is cleared to preserve invariant)
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.176 2013/07/10 17:15:12 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.177 2013/08/16 18:55:49 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 | */ |
@@ -399,9 +399,9 @@ static Closure *getcached (Proto *p, UpVal **encup, StkId base) { | |||
399 | 399 | ||
400 | /* | 400 | /* |
401 | ** create a new Lua closure, push it in the stack, and initialize | 401 | ** create a new Lua closure, push it in the stack, and initialize |
402 | ** its upvalues. Note that the call to 'luaC_barrierproto' must come | 402 | ** its upvalues. Note that the closure is not cached if prototype is |
403 | ** before the assignment to 'p->cache', as the function needs the | 403 | ** already black (which means that 'cache' was already cleared by the |
404 | ** original value of that field. | 404 | ** GC). |
405 | */ | 405 | */ |
406 | static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | 406 | static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, |
407 | StkId ra) { | 407 | StkId ra) { |
@@ -418,8 +418,8 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | |||
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 | /* new closure is white and local, so we do not need a barrier here */ |
420 | } | 420 | } |
421 | luaC_barrierproto(L, p, ncl); | 421 | if (!isblack(obj2gco(p))) /* cache will not break GC invariant? */ |
422 | p->cache = ncl; /* save it on cache for reuse */ | 422 | p->cache = ncl; /* save it on cache for reuse */ |
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||