diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-07 12:39:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-07 12:39:09 -0300 |
commit | 78b941039d732b01933baa44e2f14ae206e4d1f2 (patch) | |
tree | f8e1b8ddd2435d51a06761468e445b4b03e089ae /lgc.c | |
parent | 623e388bb4c75eb07af3b7f83c736841d9fb76f0 (diff) | |
download | lua-78b941039d732b01933baa44e2f14ae206e4d1f2.tar.gz lua-78b941039d732b01933baa44e2f14ae206e4d1f2.tar.bz2 lua-78b941039d732b01933baa44e2f14ae206e4d1f2.zip |
change to allow collector to stop when it goes to the atomic phase
(just for debugging)
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.142 2013/08/05 16:58:28 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.143 2013/08/07 12:18:11 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 | */ |
@@ -1009,21 +1009,22 @@ static lu_mem singlestep (lua_State *L) { | |||
1009 | return g->GCmemtrav; | 1009 | return g->GCmemtrav; |
1010 | } | 1010 | } |
1011 | case GCSpropagate: { | 1011 | case GCSpropagate: { |
1012 | if (g->gray) { | 1012 | lu_mem oldtrav = g->GCmemtrav; |
1013 | lu_mem oldtrav = g->GCmemtrav; | 1013 | lua_assert(g->gray); |
1014 | propagatemark(g); | 1014 | propagatemark(g); |
1015 | return g->GCmemtrav - oldtrav; /* memory traversed in this step */ | 1015 | if (g->gray == NULL) /* no more `gray' objects? */ |
1016 | } | 1016 | g->gcstate = GCSatomic; /* finish propagate phase */ |
1017 | else { /* no more `gray' objects */ | 1017 | return g->GCmemtrav - oldtrav; /* memory traversed in this step */ |
1018 | lu_mem work; | 1018 | } |
1019 | int sw; | 1019 | case GCSatomic: { |
1020 | g->gcstate = GCSatomic; /* finish mark phase */ | 1020 | lu_mem work; |
1021 | g->GCestimate = g->GCmemtrav; /* save what was counted */; | 1021 | int sw; |
1022 | work = atomic(L); /* add what was traversed by 'atomic' */ | 1022 | propagateall(g); /* make sure gray list is empty */ |
1023 | g->GCestimate += work; /* estimate of total memory traversed */ | 1023 | g->GCestimate = g->GCmemtrav; /* save what was counted */; |
1024 | sw = entersweep(L); | 1024 | work = atomic(L); /* add what was traversed by 'atomic' */ |
1025 | return work + sw * GCSWEEPCOST; | 1025 | g->GCestimate += work; /* estimate of total memory traversed */ |
1026 | } | 1026 | sw = entersweep(L); |
1027 | return work + sw * GCSWEEPCOST; | ||
1027 | } | 1028 | } |
1028 | case GCSsweepstring: { | 1029 | case GCSsweepstring: { |
1029 | int i; | 1030 | int i; |