diff options
-rw-r--r-- | lfunc.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 2.20 2010/03/12 19:14:06 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.21 2010/03/26 20:58:11 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 | */ |
@@ -96,10 +96,16 @@ void luaF_close (lua_State *L, StkId level) { | |||
96 | if (isdead(g, o)) | 96 | if (isdead(g, o)) |
97 | luaF_freeupval(L, uv); /* free upvalue */ | 97 | luaF_freeupval(L, uv); /* free upvalue */ |
98 | else { | 98 | else { |
99 | unlinkupval(uv); | 99 | unlinkupval(uv); /* remove upvalue from 'uvhead' list */ |
100 | setobj(L, &uv->u.value, uv->v); | 100 | setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ |
101 | uv->v = &uv->u.value; /* now current value lives here */ | 101 | uv->v = &uv->u.value; /* now current value lives here */ |
102 | luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ | 102 | gch(o)->next = g->allgc; /* link upvalue into 'allgc' list */ |
103 | g->allgc = o; | ||
104 | lua_assert(!isblack(o)); /* open upvalues are never black */ | ||
105 | if (isgray(o)) { /* is it marked? */ | ||
106 | gray2black(o); /* could not be black; now it can */ | ||
107 | luaC_barrier(L, uv, uv->v); | ||
108 | } | ||
103 | } | 109 | } |
104 | } | 110 | } |
105 | } | 111 | } |