summaryrefslogtreecommitdiff
path: root/rts/Sparks.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-05-25 15:04:35 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-05-25 15:04:35 +0000
commitf9ce05ef56187d981b5d1af51e3f53fc6f202d5b (patch)
tree7f1e10b97c8592f784c6db4c8a7b0e2775155bf9 /rts/Sparks.c
parent6c016f3803fec507f6a509a4929fc2344ee66fd8 (diff)
downloadhaskell-f9ce05ef56187d981b5d1af51e3f53fc6f202d5b.tar.gz
Make sparks into weak pointers (#2185)
The new strategies library (parallel-2.0+, preferably 2.2+) is now required for parallel programming, otherwise parallelism will be lost.
Diffstat (limited to 'rts/Sparks.c')
-rw-r--r--rts/Sparks.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/rts/Sparks.c b/rts/Sparks.c
index 3911ae9e0b..93f641757e 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -112,7 +112,7 @@ tryStealSpark (Capability *cap)
* -------------------------------------------------------------------------- */
void
-pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
+pruneSparkQueue (Capability *cap)
{
SparkPool *pool;
StgClosurePtr spark, tmp, *elements;
@@ -208,17 +208,21 @@ pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
pruned_sparks++; // discard spark
cap->sparks_pruned++;
}
- } else {
- if (!(closure_flags[INFO_PTR_TO_STRUCT(info)->type] & _NS)) {
+ } else if (HEAP_ALLOCED(spark) &&
+ (Bdescr(spark)->flags & BF_EVACUATED)) {
+ if (closure_SHOULD_SPARK(spark)) {
elements[botInd] = spark; // keep entry (new address)
- evac (user, &elements[botInd]);
botInd++;
n++;
} else {
pruned_sparks++; // discard spark
cap->sparks_pruned++;
}
+ } else {
+ pruned_sparks++; // discard spark
+ cap->sparks_pruned++;
}
+
currInd++;
// in the loop, we may reach the bounds, and instantly wrap around