diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-28 12:42:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-28 12:42:08 -0300 |
commit | ea16ee41a8b0e6fe2c8f77e901a7d99173065beb (patch) | |
tree | b3a29dddc98be6237647cee8c689988ac651254a /ldo.c | |
parent | 60d11ec31655c6c3f8fda787080e0908ac81b076 (diff) | |
download | lua-github-ea16ee41a8b0e6fe2c8f77e901a7d99173065beb.tar.gz |
no more attempt to optimize GC when parsing new modules (too complex)
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -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); } |