open upvalues cannot be old if thread is not old; when thread is old,

their list is not traversed anymore, and therefore can contain dead
elements.
This commit is contained in:
Roberto Ierusalimschy
2012-10-03 09:36:46 -03:00
parent fdae4b9453
commit 86b39206d9
2 changed files with 4 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 2.28 2012/01/20 22:05:50 roberto Exp roberto $
** $Id: lfunc.c,v 2.29 2012/05/08 13:53:33 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@@ -52,12 +52,12 @@ UpVal *luaF_findupval (lua_State *L, StkId level) {
while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
GCObject *o = obj2gco(p);
lua_assert(p->v != &p->u.value);
lua_assert(!isold(o) || isold(obj2gco(L)));
if (p->v == level) { /* found a corresponding upvalue? */
if (isdead(g, o)) /* is it dead? */
changewhite(o); /* resurrect it */
return p;
}
resetoldbit(o); /* may create a newer upval after this one */
pp = &p->next;
}
/* not found: create a new one */