aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-28 12:42:08 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-28 12:42:08 -0300
commitea16ee41a8b0e6fe2c8f77e901a7d99173065beb (patch)
treeb3a29dddc98be6237647cee8c689988ac651254a
parent60d11ec31655c6c3f8fda787080e0908ac81b076 (diff)
downloadlua-ea16ee41a8b0e6fe2c8f77e901a7d99173065beb.tar.gz
lua-ea16ee41a8b0e6fe2c8f77e901a7d99173065beb.tar.bz2
lua-ea16ee41a8b0e6fe2c8f77e901a7d99173065beb.zip
no more attempt to optimize GC when parsing new modules (too complex)
-rw-r--r--ldo.c19
1 files 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 @@
1/* 1/*
2** $Id: ldo.c,v 1.213 2003/02/13 16:08:47 roberto Exp roberto $ 2** $Id: ldo.c,v 1.214 2003/02/27 11:52:30 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -428,22 +428,13 @@ struct SParser { /* data to `f_parser' */
428}; 428};
429 429
430static void f_parser (lua_State *L, void *ud) { 430static void f_parser (lua_State *L, void *ud) {
431 lu_mem old_blocks;
432 Proto *tf;
433 Closure *cl;
434 struct SParser *p = cast(struct SParser *, ud); 431 struct SParser *p = cast(struct SParser *, ud);
435 /* before parsing, give a (good) chance to GC */ 432 Proto *tf = p->bin ? luaU_undump(L, p->z, &p->buff) :
436 if (G(L)->nblocks + G(L)->nblocks/4 >= G(L)->GCthreshold) 433 luaY_parser(L, p->z, &p->buff);
437 luaC_collectgarbage(L); 434 Closure *cl = luaF_newLclosure(L, 0, gt(L));
438 old_blocks = G(L)->nblocks;
439 tf = p->bin ? luaU_undump(L, p->z, &p->buff) : luaY_parser(L, p->z, &p->buff);
440 cl = luaF_newLclosure(L, 0, gt(L));
441 cl->l.p = tf; 435 cl->l.p = tf;
442 setclvalue(L->top, cl); 436 setclvalue(L->top, cl);
443 incr_top(L); 437 incr_top(L);
444 /* add new memory to threshold (as it probably will stay) */
445 lua_assert(G(L)->nblocks >= old_blocks);
446 G(L)->GCthreshold += (G(L)->nblocks - old_blocks);
447} 438}
448 439
449 440
@@ -455,7 +446,7 @@ int luaD_protectedparser (lua_State *L, ZIO *z, int bin) {
455 luaZ_initbuffer(L, &p.buff); 446 luaZ_initbuffer(L, &p.buff);
456 status = luaD_rawrunprotected(L, f_parser, &p); 447 status = luaD_rawrunprotected(L, f_parser, &p);
457 luaZ_freebuffer(L, &p.buff); 448 luaZ_freebuffer(L, &p.buff);
458 if (status != 0) { /* error */ 449 if (status != 0) { /* error? */
459 StkId oldtop = restorestack(L, oldtopr); 450 StkId oldtop = restorestack(L, oldtopr);
460 seterrorobj(L, status, oldtop); 451 seterrorobj(L, status, oldtop);
461 } 452 }