diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-13 10:15:11 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-13 10:15:11 -0200 |
commit | c6254dceffca200e4111f28af4230b6c892ec0d6 (patch) | |
tree | c9a122ae3c1d28cad4d9f8ed5578a8be18d0a27d /lgc.c | |
parent | a56d889f7225a3cfdfa6dfeb55db2b4ae22f1572 (diff) | |
download | lua-c6254dceffca200e4111f28af4230b6c892ec0d6.tar.gz lua-c6254dceffca200e4111f28af4230b6c892ec0d6.tar.bz2 lua-c6254dceffca200e4111f28af4230b6c892ec0d6.zip |
a different option for the GC
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.17 2004/11/24 19:20:21 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.18 2004/12/06 17:53:42 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -27,6 +27,7 @@ | |||
27 | #define GCSWEEPMAX 10 | 27 | #define GCSWEEPMAX 10 |
28 | #define GCSWEEPCOST 30 | 28 | #define GCSWEEPCOST 30 |
29 | #define GCFINALIZECOST 100 | 29 | #define GCFINALIZECOST 100 |
30 | #define GCSTEPMUL 8 | ||
30 | 31 | ||
31 | 32 | ||
32 | #define FIXEDMASK bitmask(FIXEDBIT) | 33 | #define FIXEDMASK bitmask(FIXEDBIT) |
@@ -621,18 +622,17 @@ static l_mem singlestep (lua_State *L) { | |||
621 | 622 | ||
622 | void luaC_step (lua_State *L) { | 623 | void luaC_step (lua_State *L) { |
623 | global_State *g = G(L); | 624 | global_State *g = G(L); |
624 | l_mem lim = (g->totalbytes - (g->GCthreshold - GCSTEPSIZE)) * g->stepmul; | 625 | l_mem lim = (g->totalbytes - (g->GCthreshold - GCSTEPSIZE)) * GCSTEPMUL; |
625 | do { | 626 | do { |
626 | lim -= singlestep(L); | 627 | lim -= singlestep(L); |
627 | if (g->gcstate == GCSpause) | 628 | if (g->gcstate == GCSpause) |
628 | break; | 629 | break; |
629 | } while (lim > 0 || !g->incgc); | 630 | } while (lim > 0 || !g->incgc); |
630 | if (g->incgc) | 631 | if (g->gcstate != GCSpause) |
631 | g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/STEPMUL; */ | 632 | g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/STEPMUL; */ |
632 | else { | 633 | else { |
633 | lua_assert(g->totalbytes >= g->estimate); | 634 | lua_assert(g->totalbytes >= g->estimate); |
634 | lua_assert(g->gcstate == GCSpause); | 635 | g->GCthreshold = g->estimate + ((g->estimate/GCDIV) * g->gcpace); |
635 | g->GCthreshold = 2*g->estimate; | ||
636 | } | 636 | } |
637 | } | 637 | } |
638 | 638 | ||