summaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-05-10 15:23:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-05-10 15:23:45 -0300
commit1c1a98e872ad09b12fe2085031f0045f993ca5f0 (patch)
treea711825a8b3f991797ef19dfaad083acbf59189a /lfunc.c
parentc006f085d98923e505c7fe8909944d3c182f8301 (diff)
downloadlua-1c1a98e872ad09b12fe2085031f0045f993ca5f0.tar.gz
lua-1c1a98e872ad09b12fe2085031f0045f993ca5f0.tar.bz2
lua-1c1a98e872ad09b12fe2085031f0045f993ca5f0.zip
corrected some places where an old object could end up in front
of a new one + minimal documentation about this problem
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lfunc.c b/lfunc.c
index 4e72fcad..6c8dda4b 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -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 */