X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FSparks.h;h=fd62c1288d35ddb833a656f50a262e4d476d38f6;hb=65914a2cb71caf01655b16a75b283871e2482041;hp=96968890bae253291e137b27739821a54883089b;hpb=2b16fa4791b08b02df8461f3b79d0e44d72d0960;p=ghc-hetmet.git diff --git a/rts/Sparks.h b/rts/Sparks.h index 9696889..fd62c12 100644 --- a/rts/Sparks.h +++ b/rts/Sparks.h @@ -51,17 +51,24 @@ typedef struct SparkPool_ { } SparkPool; -/* INVARIANTS, in this order: bottom/top consistent, reasonable size, - topBound consistent, space pointer, space accessible to us */ +/* INVARIANTS, in this order: reasonable size, + 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)->bottom >= (p)->top); \ ASSERT((p)->size > 0); \ - ASSERT((p)->size > (p)->bottom - (p)->top); \ ASSERT((p)->topBound <= (p)->top); \ ASSERT((p)->elements != NULL); \ ASSERT(*((p)->elements) || 1); \ ASSERT(*((p)->elements - 1 + ((p)->size)) || 1); +// No: it is possible that top > bottom when using reclaimSpark() +// ASSERT((p)->bottom >= (p)->top); +// ASSERT((p)->size > (p)->bottom - (p)->top); + // Initialisation void initSparkPools (void);