diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-29 14:34:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-29 14:34:35 -0300 |
commit | 5a7a0c72d8a4766e1541345350500f3a0a14361b (patch) | |
tree | d4f3ff42625b1f122af2b302e8ad9474dc6c19a8 | |
parent | ee7478e884adc6991f786f30c371a4a3da4e1992 (diff) | |
download | lua-5a7a0c72d8a4766e1541345350500f3a0a14361b.tar.gz lua-5a7a0c72d8a4766e1541345350500f3a0a14361b.tar.bz2 lua-5a7a0c72d8a4766e1541345350500f3a0a14361b.zip |
'luaC_linkupval' embedded into call site
-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 | } |