From da19c436cc361401563eeda2cca3d161a6ddeef7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 16 Aug 2002 11:45:55 -0300 Subject: cleaning the stage for generational collection --- lfunc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lfunc.c') diff --git a/lfunc.c b/lfunc.c index e973d850..71cff734 100644 --- a/lfunc.c +++ b/lfunc.c @@ -1,5 +1,5 @@ /* -** $Id: lfunc.c,v 1.56 2002/05/02 13:06:20 roberto Exp roberto $ +** $Id: lfunc.c,v 1.57 2002/06/20 20:41:46 roberto Exp roberto $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -54,6 +54,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { pp = &p->next; } p = luaM_new(L, UpVal); /* not found: create a new one */ + p->marked = 1; /* open upvalues should not be collected */ p->v = level; /* current value lives in the stack */ p->next = *pp; /* chain it in the proper position */ *pp = p; @@ -64,6 +65,8 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { void luaF_close (lua_State *L, StkId level) { UpVal *p; while ((p = L->openupval) != NULL && p->v >= level) { + lua_assert(p->marked); + p->marked = 0; setobj(&p->value, p->v); /* save current value */ p->v = &p->value; /* now current value lives here */ L->openupval = p->next; /* remove from `open' list */ -- cgit v1.2.3-55-g6feb