summaryrefslogtreecommitdiff
path: root/rts/Sparks.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-11-06 15:56:48 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-11-06 15:56:48 +0000
commit99836ac39665b577dde6945a60631c75e954e3dc (patch)
tree694f331636ce87c14e1d2609e94990febe89e1d8 /rts/Sparks.c
parent48685b251fcfcd1295c779a01de724122e312cf5 (diff)
downloadhaskell-99836ac39665b577dde6945a60631c75e954e3dc.tar.gz
pruneSparkQueue(): fix bug when top>bottom
Diffstat (limited to 'rts/Sparks.c')
-rw-r--r--rts/Sparks.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c
index e7273f3ed0..cb3d8d98eb 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -389,6 +389,12 @@ pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
pool = cap->sparks;
+ // it is possible that top > bottom, indicating an empty pool. We
+ // fix that here; this is only necessary because the loop below
+ // assumes it.
+ if (pool->top > pool->bottom)
+ pool->top = pool->bottom;
+
// 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.