summaryrefslogtreecommitdiff
path: root/rts/sm/Evac.c-inc
diff options
context:
space:
mode:
authorSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:29:06 +0000
committerSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:29:06 +0000
commit77798610bc585a1eea3b6695c4a3fee1ccba70ba (patch)
tree5da6464cf5240e644647e8f6065762177e4fcd35 /rts/sm/Evac.c-inc
parent49780c2e25cfbe821d585c5a31cb95aa49f41f14 (diff)
downloadhaskell-77798610bc585a1eea3b6695c4a3fee1ccba70ba.tar.gz
Use the BF_EVACUATED flag to indicate to-space consistently
BF_EVACUATED is now set on all blocks except those that we are copying. This means we don't need a separate test for gen>N in evacuate(), because in generations older than N, BF_EVACUATED will be set anyway. The disadvantage is that we have to reset the BF_EVACUATED flag on the blocks of any generation we're collecting before starting GC. Results in a small speed improvement.
Diffstat (limited to 'rts/sm/Evac.c-inc')
-rw-r--r--rts/sm/Evac.c-inc28
1 files changed, 9 insertions, 19 deletions
diff --git a/rts/sm/Evac.c-inc b/rts/sm/Evac.c-inc
index cafbfdad91..16bd297afc 100644
--- a/rts/sm/Evac.c-inc
+++ b/rts/sm/Evac.c-inc
@@ -305,28 +305,18 @@ loop:
bd = Bdescr((P_)q);
- if (bd->gen_no > N) {
- /* Can't evacuate this object, because it's in a generation
- * older than the ones we're collecting. Let's hope that it's
- * in gct->evac_step or older, or we will have to arrange to track
- * this pointer using the mutable list.
- */
- if (bd->step < gct->evac_step) {
- // nope
- gct->failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
- }
- return;
- }
-
if ((bd->flags & (BF_LARGE | BF_COMPACTED | BF_EVACUATED)) != 0) {
- /* pointer into to-space: just return it. This normally
- * shouldn't happen, but alllowing it makes certain things
- * slightly easier (eg. the mutable list can contain the same
- * object twice, for example).
- */
+ // pointer into to-space: just return it. It might be a pointer
+ // into a generation that we aren't collecting (> N), or it
+ // might just be a pointer into to-space. The latter doesn't
+ // happen often, but allowing it makes certain things a bit
+ // easier; e.g. scavenging an object is idempotent, so it's OK to
+ // have an object on the mutable list multiple times.
if (bd->flags & BF_EVACUATED) {
+ // We aren't copying this object, so we have to check
+ // whether it is already in the target generation. (this is
+ // the write barrier).
if (bd->step < gct->evac_step) {
gct->failed_to_evac = rtsTrue;
TICK_GC_FAILED_PROMOTION();