diff options
Diffstat (limited to 'lfunc.c')
-rw-r--r-- | lfunc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 2.22 2010/04/29 17:34:35 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.23 2010/04/29 21:43:36 roberto Exp roberto $ |
3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -52,12 +52,14 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { | |||
52 | UpVal *p; | 52 | UpVal *p; |
53 | UpVal *uv; | 53 | UpVal *uv; |
54 | while (*pp != NULL && (p = gco2uv(*pp))->v >= level) { | 54 | while (*pp != NULL && (p = gco2uv(*pp))->v >= level) { |
55 | GCObject *o = obj2gco(p); | ||
55 | lua_assert(p->v != &p->u.value); | 56 | lua_assert(p->v != &p->u.value); |
56 | if (p->v == level) { /* found a corresponding upvalue? */ | 57 | if (p->v == level) { /* found a corresponding upvalue? */ |
57 | if (isdead(g, obj2gco(p))) /* is it dead? */ | 58 | if (isdead(g, o)) /* is it dead? */ |
58 | changewhite(obj2gco(p)); /* ressurrect it */ | 59 | changewhite(o); /* ressurrect it */ |
59 | return p; | 60 | return p; |
60 | } | 61 | } |
62 | resetoldbit(o); /* may create a newer upval after this one */ | ||
61 | pp = &p->next; | 63 | pp = &p->next; |
62 | } | 64 | } |
63 | /* not found: create a new one */ | 65 | /* not found: create a new one */ |