summaryrefslogtreecommitdiff
path: root/libitm/method-ml.cc
diff options
context:
space:
mode:
authortorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-16 22:08:41 +0000
committertorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-16 22:08:41 +0000
commit0ca817a713be483e033c0a122621a58fee972298 (patch)
tree6344612f38b36403102234efac1277ca09d2d40b /libitm/method-ml.cc
parent673441b04a9379c7bcb1ede82a4fe2961da658af (diff)
downloadgcc-0ca817a713be483e033c0a122621a58fee972298.tar.gz
libitm: Ensure proxy privatization safety.
* method-gl.cc (gl_wt_dispatch::trycommit): Ensure proxy privatization safety. * method-ml.cc (ml_wt_dispatch::trycommit): Likewise. * libitm/testsuite/libitm.c/priv-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232469 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/method-ml.cc')
-rw-r--r--libitm/method-ml.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/libitm/method-ml.cc b/libitm/method-ml.cc
index 723643ab97c..c1a6771d3f9 100644
--- a/libitm/method-ml.cc
+++ b/libitm/method-ml.cc
@@ -513,6 +513,21 @@ public:
if (!tx->writelog.size())
{
tx->readlog.clear();
+ // We still need to ensure privatization safety, unfortunately. While
+ // we cannot have privatized anything by ourselves (because we are not
+ // an update transaction), we can have observed the commits of
+ // another update transaction that privatized something. Because any
+ // commit happens before ensuring privatization, our snapshot and
+ // commit can thus have happened before ensuring privatization safety
+ // for this commit/snapshot time. Therefore, before we can return to
+ // nontransactional code that might use the privatized data, we must
+ // ensure privatization safety for our snapshot time.
+ // This still seems to be better than not allowing use of the
+ // snapshot time before privatization safety has been ensured because
+ // we at least can run transactions such as this one, and in the
+ // meantime the transaction producing this commit time might have
+ // finished ensuring privatization safety for it.
+ priv_time = tx->shared_state.load(memory_order_relaxed);
return true;
}