From 65914a2cb71caf01655b16a75b283871e2482041 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 19 Nov 2008 14:30:43 +0000 Subject: [PATCH] Remove incorrect assertions in steal() --- rts/Sparks.c | 8 ++++++-- rts/Sparks.h | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rts/Sparks.c b/rts/Sparks.c index cb3d8d9..571529a 100644 --- a/rts/Sparks.c +++ b/rts/Sparks.c @@ -202,10 +202,12 @@ steal(SparkPool *deque) StgClosurePtr stolen; StgWord b,t; - ASSERT_SPARK_POOL_INVARIANTS(deque); +// Can't do this on someone else's spark pool: +// ASSERT_SPARK_POOL_INVARIANTS(deque); b = deque->bottom; t = deque->top; + if (b - t <= 0 ) { return NULL; /* already looks empty, abort */ } @@ -222,7 +224,9 @@ steal(SparkPool *deque) return NULL; } /* else: OK, top has been incremented by the cas call */ - ASSERT_SPARK_POOL_INVARIANTS(deque); +// Can't do this on someone else's spark pool: +// ASSERT_SPARK_POOL_INVARIANTS(deque); + /* return stolen element */ return stolen; } diff --git a/rts/Sparks.h b/rts/Sparks.h index f24ccca..fd62c12 100644 --- a/rts/Sparks.h +++ b/rts/Sparks.h @@ -52,7 +52,12 @@ typedef struct SparkPool_ { /* INVARIANTS, in this order: reasonable size, - topBound consistent, space pointer, space accessible to us */ + topBound consistent, space pointer, space accessible to us. + + NB. This is safe to use only (a) on a spark pool owned by the + current thread, or (b) when there's only one thread running, or no + stealing going on (e.g. during GC). +*/ #define ASSERT_SPARK_POOL_INVARIANTS(p) \ ASSERT((p)->size > 0); \ ASSERT((p)->topBound <= (p)->top); \ -- 1.7.10.4