aboutsummaryrefslogtreecommitdiff
path: root/libitm/query.cc
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2013-06-20 16:40:54 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2013-06-20 16:40:54 +0000
commit480c696bb0f3253c9a53d9c2be2e29e1e5dffdc6 (patch)
treef73b28638776b1747b490781d1297b42620eb10e /libitm/query.cc
parentb1db457bf9ac2c086273c8863b94b3bf814a6dd9 (diff)
downloadgcc-480c696bb0f3253c9a53d9c2be2e29e1e5dffdc6.zip
gcc-480c696bb0f3253c9a53d9c2be2e29e1e5dffdc6.tar.gz
gcc-480c696bb0f3253c9a53d9c2be2e29e1e5dffdc6.tar.bz2
libitm: Handle HTM fastpath in status query functions.
* query.cc (_ITM_inTransaction): Abort when using the HTM fastpath. (_ITM_getTransactionId): Same. * config/x86/target.h (htm_transaction_active): New. From-SVN: r200251
Diffstat (limited to 'libitm/query.cc')
-rw-r--r--libitm/query.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/libitm/query.cc b/libitm/query.cc
index 5707321..39a35b3 100644
--- a/libitm/query.cc
+++ b/libitm/query.cc
@@ -43,6 +43,15 @@ _ITM_libraryVersion (void)
_ITM_howExecuting ITM_REGPARM
_ITM_inTransaction (void)
{
+#if defined(USE_HTM_FASTPATH)
+ // If we use the HTM fastpath, we cannot reliably detect whether we are
+ // in a transaction because this function can be called outside of
+ // a transaction and thus we can't deduce this by looking at just the serial
+ // lock. This function isn't used in practice currently, so the easiest
+ // way to handle it is to just abort.
+ if (htm_fastpath && htm_transaction_active())
+ htm_abort();
+#endif
struct gtm_thread *tx = gtm_thr();
if (tx && (tx->nesting > 0))
{
@@ -58,6 +67,11 @@ _ITM_inTransaction (void)
_ITM_transactionId_t ITM_REGPARM
_ITM_getTransactionId (void)
{
+#if defined(USE_HTM_FASTPATH)
+ // See ITM_inTransaction.
+ if (htm_fastpath && htm_transaction_active())
+ htm_abort();
+#endif
struct gtm_thread *tx = gtm_thr();
return (tx && (tx->nesting > 0)) ? tx->id : _ITM_noTransactionId;
}