diff options
author | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 17:04:40 +0000 |
---|---|---|
committer | torvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 17:04:40 +0000 |
commit | 5b35a7918cc42521165f68f4fe3975e25103c798 (patch) | |
tree | 9fd7bd08f877808bd7bb4eb601fd7482c9c85d6f /libitm/config/posix | |
parent | 024c1ad598b7c9037f5417f56e367f7dd6b6ea45 (diff) | |
download | gcc-5b35a7918cc42521165f68f4fe3975e25103c798.tar.gz |
Add HTM fastpath and use Intel RTM for it on x86.
* beginend.cc (htm_fastpath): New.
(gtm_thread::begin_transaction, _ITM_commitTransaction,
_ITM_commitTransactionEH): Add HTM fastpath handling.
* config/linux/rwlock.h (gtm_rwlock.is_write_locked): New.
* config/posix/rwlock.h (gtm_rwlock.is_write_locked): New.
* config/x86/target.h (htm_available, htm_init, htm_begin_success,
htm_begin, htm_commit, htm_abort, htm_abort_should_retry): New.
* configure.tgt: Add -mrtm to XCFLAGS.
* method-serial.cc (htm_mg, o_htm_mg, htm_dispatch, dispatch_htm): New.
(gtm_thread::serialirr_mode): Add HTM fastpath handling.
* libitm_i.h (htm_fastpath, dispatch_htm): Declare.
* retry.cc (parse_default_method): Add HTM method parsing.
(gtm_thread::number_of_threads_changed): Use HTM by default if
available.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193369 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/config/posix')
-rw-r--r-- | libitm/config/posix/rwlock.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libitm/config/posix/rwlock.h b/libitm/config/posix/rwlock.h index a1a6042e562..79f14296df6 100644 --- a/libitm/config/posix/rwlock.h +++ b/libitm/config/posix/rwlock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009, 2011 Free Software Foundation, Inc. +/* Copyright (C) 2009, 2011, 2012 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>. This file is part of the GNU Transactional Memory Library (libitm). @@ -74,6 +74,14 @@ class gtm_rwlock bool write_upgrade (gtm_thread *tx); void write_upgrade_finish (gtm_thread *tx); + // Returns true iff there is a concurrent active or waiting writer. + // This is primarily useful for simple HyTM approaches, and the value being + // checked is loaded with memory_order_relaxed. + bool is_write_locked() + { + return summary.load (memory_order_relaxed) & (a_writer | w_writer); + } + protected: bool write_lock_generic (gtm_thread *tx); }; |