From 0df6635711230ab306710056f621b6da59fac5ea Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 21 Aug 2013 17:09:51 -0300 Subject: "fixed" objects kept in a separated list (instead of being kept in 'allgc' list with a bit marking them) --- lgc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index 84741565..fddc43cf 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.148 2013/08/20 17:46:34 roberto Exp roberto $ +** $Id: lgc.c,v 2.149 2013/08/21 19:21:16 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -189,6 +189,16 @@ void luaC_checkupvalcolor (global_State *g, UpVal *uv) { } +void luaC_fix (lua_State *L, GCObject *o) { + global_State *g = G(L); + lua_assert(g->allgc == o); + white2gray(o); + g->allgc = o->gch.next; /* remove object from 'allgc' list */ + o->gch.next = g->fixedgc; /* link it to 'fixedgc' list */ + g->fixedgc = o; +} + + /* ** create a new collectable object (with given type and size) and link ** it to '*list'. 'offset' tells how many bytes to allocate before the @@ -927,6 +937,7 @@ void luaC_freeallobjects (lua_State *L) { g->gckind = KGC_NORMAL; sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */ sweepwholelist(L, &g->allgc); + sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ lua_assert(g->strt.nuse == 0); } -- cgit v1.2.3-55-g6feb