From ea16ee41a8b0e6fe2c8f77e901a7d99173065beb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 28 Feb 2003 12:42:08 -0300 Subject: [PATCH] no more attempt to optimize GC when parsing new modules (too complex) --- ldo.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ldo.c b/ldo.c index 253be07a..a285d6e1 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.213 2003/02/13 16:08:47 roberto Exp roberto $ +** $Id: ldo.c,v 1.214 2003/02/27 11:52:30 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -428,22 +428,13 @@ struct SParser { /* data to `f_parser' */ }; static void f_parser (lua_State *L, void *ud) { - lu_mem old_blocks; - Proto *tf; - Closure *cl; struct SParser *p = cast(struct SParser *, ud); - /* before parsing, give a (good) chance to GC */ - if (G(L)->nblocks + G(L)->nblocks/4 >= G(L)->GCthreshold) - luaC_collectgarbage(L); - old_blocks = G(L)->nblocks; - tf = p->bin ? luaU_undump(L, p->z, &p->buff) : luaY_parser(L, p->z, &p->buff); - cl = luaF_newLclosure(L, 0, gt(L)); + Proto *tf = p->bin ? luaU_undump(L, p->z, &p->buff) : + luaY_parser(L, p->z, &p->buff); + Closure *cl = luaF_newLclosure(L, 0, gt(L)); cl->l.p = tf; setclvalue(L->top, cl); incr_top(L); - /* add new memory to threshold (as it probably will stay) */ - lua_assert(G(L)->nblocks >= old_blocks); - G(L)->GCthreshold += (G(L)->nblocks - old_blocks); } @@ -455,7 +446,7 @@ int luaD_protectedparser (lua_State *L, ZIO *z, int bin) { luaZ_initbuffer(L, &p.buff); status = luaD_rawrunprotected(L, f_parser, &p); luaZ_freebuffer(L, &p.buff); - if (status != 0) { /* error */ + if (status != 0) { /* error? */ StkId oldtop = restorestack(L, oldtopr); seterrorobj(L, status, oldtop); }