projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In +RTS --info output, use YES rather than Yes
[ghc-hetmet.git]
/
rts
/
STM.c
diff --git
a/rts/STM.c
b/rts/STM.c
index
c271a25
..
b9be955
100644
(file)
--- a/
rts/STM.c
+++ b/
rts/STM.c
@@
-306,7
+306,7
@@
static StgClosure *lock_tvar(StgTRecHeader *trec,
do {
do {
result = s -> current_value;
do {
do {
result = s -> current_value;
- } while (GET_INFO(result) == &stg_TREC_HEADER_info);
+ } while (GET_INFO(UNTAG_CLOSURE(result)) == &stg_TREC_HEADER_info);
} while (cas((void *)&(s -> current_value),
(StgWord)result, (StgWord)trec) != (StgWord)result);
return result;
} while (cas((void *)&(s -> current_value),
(StgWord)result, (StgWord)trec) != (StgWord)result);
return result;
@@
-388,10
+388,18
@@
static void unpark_tso(Capability *cap, StgTSO *tso) {
static void unpark_waiters_on(Capability *cap, StgTVar *s) {
StgTVarWatchQueue *q;
static void unpark_waiters_on(Capability *cap, StgTVar *s) {
StgTVarWatchQueue *q;
+ StgTVarWatchQueue *trail;
TRACE("unpark_waiters_on tvar=%p", s);
TRACE("unpark_waiters_on tvar=%p", s);
- for (q = s -> first_watch_queue_entry;
- q != END_STM_WATCH_QUEUE;
+ // unblock TSOs in reverse order, to be a bit fairer (#2319)
+ for (q = s -> first_watch_queue_entry, trail = q;
+ q != END_STM_WATCH_QUEUE;
q = q -> next_queue_entry) {
q = q -> next_queue_entry) {
+ trail = q;
+ }
+ q = trail;
+ for (;
+ q != END_STM_WATCH_QUEUE;
+ q = q -> prev_queue_entry) {
if (watcher_is_tso(q)) {
unpark_tso(cap, (StgTSO *)(q -> closure));
}
if (watcher_is_tso(q)) {
unpark_tso(cap, (StgTSO *)(q -> closure));
}
@@
-1565,7
+1573,7
@@
static StgClosure *read_current_value(StgTRecHeader *trec STG_UNUSED, StgTVar *t
result = tvar -> current_value;
#if defined(STM_FG_LOCKS)
result = tvar -> current_value;
#if defined(STM_FG_LOCKS)
- while (GET_INFO(result) == &stg_TREC_HEADER_info) {
+ while (GET_INFO(UNTAG_CLOSURE(result)) == &stg_TREC_HEADER_info) {
TRACE("%p : read_current_value(%p) saw %p", trec, tvar, result);
result = tvar -> current_value;
}
TRACE("%p : read_current_value(%p) saw %p", trec, tvar, result);
result = tvar -> current_value;
}