summaryrefslogtreecommitdiff
path: root/rts/STM.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-12-18 08:43:29 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-12-18 08:43:29 +0000
commit55c55f141b8b312512cce1d7e0fbd3a8088de964 (patch)
treebedb7b8b55d0a35c54c59cf8d02a092fedb237c8 /rts/STM.c
parent6e0d45a8b6a3c991683ea2e2d2eee23dfeb1cf08 (diff)
downloadhaskell-55c55f141b8b312512cce1d7e0fbd3a8088de964.tar.gz
Revert "Fix a bug in the handling of nested orElse"
This reverts commit f184d9caffa09750ef6a374a7987b9213d6db28e. The next commit will fix it in a better way.
Diffstat (limited to 'rts/STM.c')
-rw-r--r--rts/STM.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/rts/STM.c b/rts/STM.c
index e7232b7438..0a4d0b2a96 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -1460,28 +1460,10 @@ StgBool stmCommitNestedTransaction(Capability *cap, StgTRecHeader *trec) {
StgTVar *s;
s = e -> tvar;
-
- // Careful! We might have a read entry here that we don't want
- // to spam over the update entry in the enclosing TRec. e.g. in
- //
- // t <- newTVar 1
- // writeTVar t 2
- // ((readTVar t >> retry) `orElse` return ()) `orElse` return ()
- //
- // - the innermost txn first aborts, giving us a read-only entry
- // with e->expected_value == e->new_value == 1
- // - the inner orElse commits into the outer orElse, which
- // lands us here. If we unconditionally did
- // merge_update_into(), then we would overwrite the outer
- // TRec's update, so we must check whether the entry is an
- // update or not, and if not, just do merge_read_into.
- //
- if (entry_is_update(e)) {
+ if (entry_is_update(e)) {
unlock_tvar(cap, trec, s, e -> expected_value, FALSE);
- merge_update_into(cap, et, s, e -> expected_value, e -> new_value);
- } else {
- merge_read_into(cap, et, s, e -> expected_value);
- }
+ }
+ merge_update_into(cap, et, s, e -> expected_value, e -> new_value);
ACQ_ASSERT(s -> current_value != (StgClosure *)trec);
});
} else {