aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-16 11:45:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-16 11:45:55 -0300
commitda19c436cc361401563eeda2cca3d161a6ddeef7 (patch)
tree9d2d7e3f6c00d88dc659d123c79d4157ffd36ffb /lfunc.c
parent0039feb9dae27e25c0c719f49d954741fb2babf3 (diff)
downloadlua-da19c436cc361401563eeda2cca3d161a6ddeef7.tar.gz
lua-da19c436cc361401563eeda2cca3d161a6ddeef7.tar.bz2
lua-da19c436cc361401563eeda2cca3d161a6ddeef7.zip
cleaning the stage for generational collection
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lfunc.c b/lfunc.c
index e973d850..71cff734 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.c,v 1.56 2002/05/02 13:06:20 roberto Exp roberto $ 2** $Id: lfunc.c,v 1.57 2002/06/20 20:41:46 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*/
@@ -54,6 +54,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) {
54 pp = &p->next; 54 pp = &p->next;
55 } 55 }
56 p = luaM_new(L, UpVal); /* not found: create a new one */ 56 p = luaM_new(L, UpVal); /* not found: create a new one */
57 p->marked = 1; /* open upvalues should not be collected */
57 p->v = level; /* current value lives in the stack */ 58 p->v = level; /* current value lives in the stack */
58 p->next = *pp; /* chain it in the proper position */ 59 p->next = *pp; /* chain it in the proper position */
59 *pp = p; 60 *pp = p;
@@ -64,6 +65,8 @@ UpVal *luaF_findupval (lua_State *L, StkId level) {
64void luaF_close (lua_State *L, StkId level) { 65void luaF_close (lua_State *L, StkId level) {
65 UpVal *p; 66 UpVal *p;
66 while ((p = L->openupval) != NULL && p->v >= level) { 67 while ((p = L->openupval) != NULL && p->v >= level) {
68 lua_assert(p->marked);
69 p->marked = 0;
67 setobj(&p->value, p->v); /* save current value */ 70 setobj(&p->value, p->v); /* save current value */
68 p->v = &p->value; /* now current value lives here */ 71 p->v = &p->value; /* now current value lives here */
69 L->openupval = p->next; /* remove from `open' list */ 72 L->openupval = p->next; /* remove from `open' list */