projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
White space and spelling in comments
[ghc-hetmet.git]
/
rts
/
Sparks.c
diff --git
a/rts/Sparks.c
b/rts/Sparks.c
index
cb3d8d9
..
9e4492a
100644
(file)
--- a/
rts/Sparks.c
+++ b/
rts/Sparks.c
@@
-202,11
+202,15
@@
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 ) {
+
+ // NB. b and t are unsigned; we need a signed value for the test
+ // below.
+ if ((long)b - (long)t <= 0 ) {
return NULL; /* already looks empty, abort */
}
return NULL; /* already looks empty, abort */
}
@@
-222,7
+226,9
@@
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;
}
/* return stolen element */
return stolen;
}
@@
-255,7
+261,7
@@
looksEmpty(SparkPool* deque)
StgWord t = deque->top;
StgWord b = deque->bottom;
/* try to prefer false negatives by reading top first */
StgWord t = deque->top;
StgWord b = deque->bottom;
/* try to prefer false negatives by reading top first */
- return (b - t <= 0);
+ return ((long)b - (long)t <= 0);
/* => array is *never* completely filled, always 1 place free! */
}
/* => array is *never* completely filled, always 1 place free! */
}
@@
-300,7
+306,10
@@
pushBottom (SparkPool* deque, StgClosurePtr elem)
This is why we do not just call empty(deque) here.
*/
t = deque->topBound;
This is why we do not just call empty(deque) here.
*/
t = deque->topBound;
- if ( b - t >= sz ) { /* nota bene: sz == deque->size - 1, thus ">=" */
+ if ( (StgInt)b - (StgInt)t >= (StgInt)sz ) {
+ /* NB. 1. sz == deque->size - 1, thus ">="
+ 2. signed comparison, it is possible that t > b
+ */
/* could be full, check the real top value in this case */
t = deque->top;
deque->topBound = t;
/* could be full, check the real top value in this case */
t = deque->top;
deque->topBound = t;