projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove incorrect assertions in steal()
[ghc-hetmet.git]
/
rts
/
Sparks.c
diff --git
a/rts/Sparks.c
b/rts/Sparks.c
index
38a3090
..
571529a
100644
(file)
--- a/
rts/Sparks.c
+++ b/
rts/Sparks.c
@@
-44,6
+44,7
@@
#include "RtsUtils.h"
#include "ParTicky.h"
#include "Trace.h"
#include "RtsUtils.h"
#include "ParTicky.h"
#include "Trace.h"
+#include "Prelude.h"
#include "SMP.h" // for cas
#include "SMP.h" // for cas
@@
-201,10
+202,12
@@
steal(SparkPool *deque)
StgClosurePtr stolen;
StgWord b,t;
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;
b = deque->bottom;
t = deque->top;
+
if (b - t <= 0 ) {
return NULL; /* already looks empty, abort */
}
if (b - t <= 0 ) {
return NULL; /* already looks empty, abort */
}
@@
-221,14
+224,17
@@
steal(SparkPool *deque)
return NULL;
} /* else: OK, top has been incremented by the cas call */
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;
}
StgClosure *
/* return stolen element */
return stolen;
}
StgClosure *
-tryStealSpark (SparkPool *pool)
+tryStealSpark (Capability *cap)
{
{
+ SparkPool *pool = cap->sparks;
StgClosure *stolen;
do {
StgClosure *stolen;
do {
@@
-264,13
+270,13
@@
looksEmpty(SparkPool* deque)
* -------------------------------------------------------------------------- */
void
* -------------------------------------------------------------------------- */
void
-createSparkThread (Capability *cap, StgClosure *p)
+createSparkThread (Capability *cap)
{
StgTSO *tso;
{
StgTSO *tso;
- tso = createGenThread (cap, RtsFlags.GcFlags.initialStkSize, p);
+ tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize,
+ &base_GHCziConc_runSparks_closure);
appendToRunQueue(cap,tso);
appendToRunQueue(cap,tso);
- cap->sparks_converted++;
}
/* -----------------------------------------------------------------------------
}
/* -----------------------------------------------------------------------------
@@
-387,6
+393,12
@@
pruneSparkQueue (evac_fn evac, void *user, Capability *cap)
pool = cap->sparks;
pool = cap->sparks;
+ // it is possible that top > bottom, indicating an empty pool. We
+ // fix that here; this is only necessary because the loop below
+ // assumes it.
+ if (pool->top > pool->bottom)
+ pool->top = pool->bottom;
+
// 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.
// 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.