diff options
author | Duncan Coutts <duncan@well-typed.com> | 2011-06-01 17:16:29 +0100 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2011-07-18 16:31:13 +0100 |
commit | e0b98b42847dea19aff24df2faa354c9d414fc87 (patch) | |
tree | e354b2c867ffe1d5e1e71b999c25139d5312661f /rts/Sparks.h | |
parent | 81eddb4c58c6d4171a46c727574112e2083c4878 (diff) | |
download | haskell-e0b98b42847dea19aff24df2faa354c9d414fc87.tar.gz |
Improve the newSpark dud test by using the pointer tag bits
newSpark() checks if the spark is a dud, and if so does not add it to
the spark pool. Previously, newSpark would discard the pointer tag bits
and just check closure_SHOULD_SPARK(p). We can take advantage of the
tag bits which can tell us if the pointer points to a value. If it is,
it's a dud spark and we don't need to add it to the spark pool.
Diffstat (limited to 'rts/Sparks.h')
-rw-r--r-- | rts/Sparks.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rts/Sparks.h b/rts/Sparks.h index cffe99dd39..d714cb5d09 100644 --- a/rts/Sparks.h +++ b/rts/Sparks.h @@ -31,6 +31,8 @@ INLINE_HEADER StgClosure* reclaimSpark(SparkPool *pool); INLINE_HEADER rtsBool looksEmpty(SparkPool* deque); StgClosure * tryStealSpark (Capability *cap); +INLINE_HEADER rtsBool fizzledSpark (StgClosure *); + void freeSparkPool (SparkPool *pool); void createSparkThread (Capability *cap); void traverseSparkQueue(evac_fn evac, void *user, Capability *cap); @@ -63,6 +65,11 @@ INLINE_HEADER void discardSparks (SparkPool *pool) discardElements(pool); } +INLINE_HEADER rtsBool fizzledSpark (StgClosure *spark) +{ + return (GET_CLOSURE_TAG(spark) != 0 || !closure_SHOULD_SPARK(spark)); +} + #endif // THREADED_RTS #include "EndPrivate.h" |