From 840eb5b9b8894281e414d78cdbe037bc7b458e74 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 5 Nov 2008 15:03:59 +0000 Subject: [PATCH] retreat the top/bottom fields of the spark pool in pruneSparkPool() --- rts/Sparks.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rts/Sparks.c b/rts/Sparks.c index 8f52a61..38a3090 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); -- 1.7.10.4