summaryrefslogtreecommitdiff
path: root/includes/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-05 21:06:25 -0400
committerBen Gamari <ben@smart-cactus.org>2020-10-24 21:01:54 -0400
commit88a7ce3893fe16c7d345e91838722b18ad728740 (patch)
treefc429629a221f803dccca345f24b1ad06f725565 /includes/rts
parent8cf50eb1b5f145d7bca9abae6220f4c2622e21b1 (diff)
downloadhaskell-88a7ce3893fe16c7d345e91838722b18ad728740.tar.gz
rts/stm: Strengthen orderings to SEQ_CST instead of volatilewip/tsan/stm
Previously the `current_value`, `first_watch_queue_entry`, and `num_updates` fields of `StgTVar` were marked as `volatile` in an attempt to provide strong ordering. Of course, this isn't sufficient. We now use proper atomic operations. In most of these cases I strengthen the ordering all the way to SEQ_CST although it's possible that some could be weakened with some thought.
Diffstat (limited to 'includes/rts')
-rw-r--r--includes/rts/storage/Closures.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index 3196efd3de..981e162ec1 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -340,9 +340,9 @@ typedef struct StgTVarWatchQueue_ {
typedef struct {
StgHeader header;
- StgClosure *volatile current_value;
- StgTVarWatchQueue *volatile first_watch_queue_entry;
- StgInt volatile num_updates;
+ StgClosure *current_value; /* accessed via atomics */
+ StgTVarWatchQueue *first_watch_queue_entry; /* accessed via atomics */
+ StgInt num_updates; /* accessed via atomics */
} StgTVar;
/* new_value == expected_value for read-only accesses */