summaryrefslogtreecommitdiff
path: root/rts/Sparks.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-11-05 15:03:59 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-11-05 15:03:59 +0000
commit840eb5b9b8894281e414d78cdbe037bc7b458e74 (patch)
tree5e0da16d2f67c24ecd951cb305d1e2ad66160bb8 /rts/Sparks.c
parent426b9e61dfa26ff086bc0195a8c5c0d2700c315e (diff)
downloadhaskell-840eb5b9b8894281e414d78cdbe037bc7b458e74.tar.gz
retreat the top/bottom fields of the spark pool in pruneSparkPool()
Diffstat (limited to 'rts/Sparks.c')
-rw-r--r--rts/Sparks.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c
index 8f52a61169..38a3090611 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -387,6 +387,13 @@ pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
pool = cap->sparks;
+ // Take this opportunity to reset top/bottom modulo the size of
+ // the array, to avoid overflow. This is only possible because no
+ // stealing is happening during GC.
+ pool->bottom -= pool->top & ~pool->moduloSize;
+ pool->top &= pool->moduloSize;
+ pool->topBound = pool->top;
+
debugTrace(DEBUG_sched,
"markSparkQueue: current spark queue len=%d; (hd=%ld; tl=%ld)",
sparkPoolSize(pool), pool->bottom, pool->top);