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 /lgc.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 'lgc.c')
-rw-r--r-- | lgc.c | 24 |
1 files changed, 1 insertions, 23 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.145 2013/08/13 17:36:44 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.146 2013/08/16 18:55:49 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -172,28 +172,6 @@ void luaC_barrierback_ (lua_State *L, GCObject *o) { | |||
172 | 172 | ||
173 | 173 | ||
174 | /* | 174 | /* |
175 | ** barrier for prototypes. When creating first closure (cache is | ||
176 | ** NULL), use a forward barrier; this may be the only closure of the | ||
177 | ** prototype (if it is a "regular" function, with a single instance) | ||
178 | ** and the prototype may be big, so it is better to avoid traversing | ||
179 | ** it again. Otherwise, use a backward barrier, to avoid marking all | ||
180 | ** possible instances. | ||
181 | */ | ||
182 | LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c) { | ||
183 | global_State *g = G(L); | ||
184 | lua_assert(isblack(obj2gco(p))); | ||
185 | if (p->cache == NULL) { /* first time? */ | ||
186 | luaC_objbarrier(L, p, c); | ||
187 | } | ||
188 | else { /* use a backward barrier */ | ||
189 | black2gray(obj2gco(p)); /* make prototype gray (again) */ | ||
190 | p->gclist = g->grayagain; | ||
191 | g->grayagain = obj2gco(p); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | |||
196 | /* | ||
197 | ** check color (and invariants) for an upvalue that is being closed, | 175 | ** check color (and invariants) for an upvalue that is being closed, |
198 | ** i.e., moved into the 'allgc' list | 176 | ** i.e., moved into the 'allgc' list |
199 | */ | 177 | */ |