diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-06-07 13:55:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-06-07 13:55:34 -0300 |
commit | fabe4ec487cb034ef983a29c52df2927be463d3c (patch) | |
tree | 4b824977d6b99b657c821681ca1a643ad345569a /lvm.c | |
parent | 575074fd857b90cd7c14c7b172e8fe147080962a (diff) | |
download | lua-fabe4ec487cb034ef983a29c52df2927be463d3c.tar.gz lua-fabe4ec487cb034ef983a29c52df2927be463d3c.tar.bz2 lua-fabe4ec487cb034ef983a29c52df2927be463d3c.zip |
better barrier for prototypes
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.120 2010/05/13 19:53:05 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.121 2010/06/04 13:25:10 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 | */ |
@@ -368,7 +368,9 @@ static Closure *getcached (Proto *p, UpVal **encup, StkId base) { | |||
368 | 368 | ||
369 | /* | 369 | /* |
370 | ** create a new Lua closure, push it in the stack, and initialize | 370 | ** create a new Lua closure, push it in the stack, and initialize |
371 | ** its upvalues | 371 | ** its upvalues. Note that the call to 'luaC_barrierproto' must come |
372 | ** before the assignment to 'p->cache', as the function needs the | ||
373 | ** orginal value of that field. | ||
372 | */ | 374 | */ |
373 | static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | 375 | static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, |
374 | StkId ra) { | 376 | StkId ra) { |
@@ -383,8 +385,8 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | |||
383 | else /* get upvalue from enclosing function */ | 385 | else /* get upvalue from enclosing function */ |
384 | ncl->l.upvals[i] = encup[uv[i].idx]; | 386 | ncl->l.upvals[i] = encup[uv[i].idx]; |
385 | } | 387 | } |
386 | p->cache = ncl; /* save it on cache, so it can be reused */ | 388 | luaC_barrierproto(L, p, ncl); |
387 | luaC_barrierproto(L, obj2gco(p)); | 389 | p->cache = ncl; /* save it on cache for reuse */ |
388 | } | 390 | } |
389 | 391 | ||
390 | 392 | ||