diff options
author | Simon Marlow <simonmarhaskell@gmail.com> | 2008-04-24 20:58:13 +0000 |
---|---|---|
committer | Simon Marlow <simonmarhaskell@gmail.com> | 2008-04-24 20:58:13 +0000 |
commit | 01ccdeea34b4853750326126f3bff9b2bdfa9a32 (patch) | |
tree | 386283d5e2e14a9e2396fe854b5950abb8883b9f /rts/Sparks.c | |
parent | 1d0e86e6cd96ce49f478c91fc01de565416ecc22 (diff) | |
download | haskell-01ccdeea34b4853750326126f3bff9b2bdfa9a32.tar.gz |
FIX #2185: sparks should not be treated as roots by the GC
Diffstat (limited to 'rts/Sparks.c')
-rw-r--r-- | rts/Sparks.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c index 0f429e2c6c..5ea296d561 100644 --- a/rts/Sparks.c +++ b/rts/Sparks.c @@ -169,9 +169,9 @@ newSpark (StgRegTable *reg, StgClosure *p) * -------------------------------------------------------------------------- */ void -markSparkQueue (evac_fn evac, void *user, Capability *cap) +updateSparkQueue (Capability *cap) { - StgClosure **sparkp, **to_sparkp; + StgClosure *spark, **sparkp, **to_sparkp; nat n, pruned_sparks; // stats only StgSparkPool *pool; @@ -184,21 +184,15 @@ markSparkQueue (evac_fn evac, void *user, Capability *cap) ASSERT_SPARK_POOL_INVARIANTS(pool); -#if defined(PARALLEL_HASKELL) - // stats only - n = 0; - pruned_sparks = 0; -#endif - sparkp = pool->hd; to_sparkp = pool->hd; while (sparkp != pool->tl) { ASSERT(*sparkp!=NULL); ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgClosure *)*sparkp))); // ToDo?: statistics gathering here (also for GUM!) - if (closure_SHOULD_SPARK(*sparkp)) { - evac(user, sparkp); - *to_sparkp++ = *sparkp; + spark = isAlive(*sparkp); + if (spark != NULL && closure_SHOULD_SPARK(spark)) { + *to_sparkp++ = spark; if (to_sparkp == pool->lim) { to_sparkp = pool->base; } @@ -215,21 +209,32 @@ markSparkQueue (evac_fn evac, void *user, Capability *cap) PAR_TICKY_MARK_SPARK_QUEUE_END(n); -#if defined(PARALLEL_HASKELL) debugTrace(DEBUG_sched, - "marked %d sparks and pruned %d sparks on [%x]", - n, pruned_sparks, mytid); -#else - debugTrace(DEBUG_sched, - "marked %d sparks and pruned %d sparks", + "updated %d sparks and pruned %d sparks", n, pruned_sparks); -#endif debugTrace(DEBUG_sched, "new spark queue len=%d; (hd=%p; tl=%p)\n", sparkPoolSize(pool), pool->hd, pool->tl); } +void +traverseSparkQueue (evac_fn evac, void *user, Capability *cap) +{ + StgClosure **sparkp; + StgSparkPool *pool; + + pool = &(cap->r.rSparks); + sparkp = pool->hd; + while (sparkp != pool->tl) { + evac(sparkp, user); + sparkp++; + if (sparkp == pool->lim) { + sparkp = pool->base; + } + } +} + #else StgInt |