@@ -64,7 +64,7 @@ void ITM_REGPARM
_ITM_dropReferences (void *ptr, size_t len)
{
gtm_transaction *tx = gtm_tx();
- if (!gtm_disp()->trydropreference (ptr, len))
+ if (!abi_disp()->trydropreference (ptr, len))
tx->restart (RESTART_VALIDATE_READ);
tx->drop_references_local (ptr, len);
tx->drop_references_allocations (ptr);
@@ -30,12 +30,12 @@ namespace {
using namespace GTM;
template<typename T>
-T do_read (const T *ptr, gtm_dispatch::lock_type lock)
+T do_read (const T *ptr, abi_dispatch::lock_type lock)
{
//
// Find the cacheline that holds the current value of *PTR.
//
- gtm_dispatch *disp = gtm_disp();
+ abi_dispatch *disp = abi_disp();
uintptr_t iptr = reinterpret_cast<uintptr_t>(ptr);
// Normalize PTR by chopping off the bottom bits so we can search
// for PTR in the cacheline hash.
@@ -95,19 +95,19 @@ T do_read (const T *ptr, gtm_dispatch::lock_type lock)
}
template<typename T>
-void do_write (T *ptr, T val, gtm_dispatch::lock_type lock)
+void do_write (T *ptr, T val, abi_dispatch::lock_type lock)
{
// Note: See comments for do_read() above for hints on this
// function. Ideally we should abstract out a lot out of these two
// functions, and avoid all this duplication.
- gtm_dispatch *disp = gtm_disp();
+ abi_dispatch *disp = abi_disp();
uintptr_t iptr = reinterpret_cast<uintptr_t>(ptr);
uintptr_t iline = iptr & -CACHELINE_SIZE;
uintptr_t iofs = iptr & (CACHELINE_SIZE - 1);
gtm_cacheline *pline = reinterpret_cast<gtm_cacheline *>(iline);
gtm_cacheline_mask m = ((gtm_cacheline_mask)2 << (sizeof(T) - 1)) - 1;
- gtm_dispatch::mask_pair pair = disp->write_lock(pline, lock);
+ abi_dispatch::mask_pair pair = disp->write_lock(pline, lock);
ptr = reinterpret_cast<T *>(&pair.line->b[iofs]);
@@ -129,7 +129,7 @@ void do_write (T *ptr, T val, gtm_dispatch::lock_type lock)
else
{
*pair.mask |= m << iofs;
- gtm_dispatch::mask_pair pair2 = disp->write_lock(pline + 1, lock);
+ abi_dispatch::mask_pair pair2 = disp->write_lock(pline + 1, lock);
uintptr_t ileft = CACHELINE_SIZE - iofs;
*pair2.mask |= m >> ileft;
@@ -151,13 +151,13 @@ void do_write (T *ptr, T val, gtm_dispatch::lock_type lock)
#define ITM_READ(T, LOCK) \
_ITM_TYPE_##T ITM_REGPARM _ITM_##LOCK##T (const _ITM_TYPE_##T *ptr) \
{ \
- return do_read (ptr, gtm_dispatch::LOCK); \
+ return do_read (ptr, abi_dispatch::LOCK); \
}
#define ITM_WRITE(T, LOCK) \
void ITM_REGPARM _ITM_##LOCK##T (_ITM_TYPE_##T *ptr, _ITM_TYPE_##T val) \
{ \
- do_write (ptr, val, gtm_dispatch::LOCK); \
+ do_write (ptr, val, abi_dispatch::LOCK); \
}
#define ITM_BARRIERS(T) \
@@ -94,7 +94,7 @@ GTM::gtm_transaction::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
static const _ITM_transactionId_t tid_block_size = 1 << 16;
gtm_transaction *tx;
- gtm_dispatch *disp;
+ abi_dispatch *disp;
uint32_t ret;
gtm_thread *thr = setup_gtm_thr ();
@@ -154,7 +154,7 @@ GTM::gtm_transaction::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
ret = a_runInstrumentedCode | a_saveLiveVariables;
}
- set_gtm_disp (disp);
+ set_abi_disp (disp);
return ret;
}
@@ -162,7 +162,7 @@ GTM::gtm_transaction::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
void
GTM::gtm_transaction::rollback ()
{
- gtm_disp()->rollback ();
+ abi_disp()->rollback ();
rollback_local ();
free_actions (&this->commit_actions);
@@ -202,7 +202,7 @@ _ITM_abortTransaction (_ITM_abortReason reason)
abort ();
tx->rollback ();
- gtm_disp()->fini ();
+ abi_disp()->fini ();
if (tx->state & gtm_transaction::STATE_SERIAL)
gtm_transaction::serial_lock.write_unlock ();
@@ -218,7 +218,7 @@ _ITM_abortTransaction (_ITM_abortReason reason)
bool
GTM::gtm_transaction::trycommit ()
{
- if (gtm_disp()->trycommit ())
+ if (abi_disp()->trycommit ())
{
commit_local ();
free_actions (&this->undo_actions);
@@ -234,7 +234,7 @@ GTM::gtm_transaction::trycommit_and_finalize ()
{
if ((this->state & gtm_transaction::STATE_ABORTING) || trycommit ())
{
- gtm_disp()->fini ();
+ abi_disp()->fini ();
set_gtm_tx (this->prev);
delete this;
if (this->state & gtm_transaction::STATE_SERIAL)
@@ -38,7 +38,7 @@ struct gtm_thread
#ifndef HAVE_ARCH_GTM_THREAD_DISP
// The dispatch table for the STM implementation currently in use. Elided
// if the target provides some efficient mechanism for storing this.
- gtm_dispatch *disp;
+ abi_dispatch *disp;
#endif
// The maximum number of free gtm_transaction structs to be kept.
@@ -87,8 +87,8 @@ static inline void set_gtm_tx(gtm_transaction *x) { gtm_thr()->tx = x; }
#ifndef HAVE_ARCH_GTM_THREAD_DISP
// If the target does not provide optimized access to the currently
// active dispatch table, simply access via GTM_THR.
-static inline gtm_dispatch * gtm_disp() { return gtm_thr()->disp; }
-static inline void set_gtm_disp(gtm_dispatch *x) { gtm_thr()->disp = x; }
+static inline abi_dispatch * abi_disp() { return gtm_thr()->disp; }
+static inline void set_abi_disp(abi_dispatch *x) { gtm_thr()->disp = x; }
#endif
} // namespace GTM
@@ -88,14 +88,14 @@ static inline void set_gtm_tx(struct gtm_transaction *x)
asm volatile (SEG_WRITE(11) : : "r"(x));
}
-static inline struct gtm_dispatch *gtm_disp(void)
+static inline struct abi_dispatch *abi_disp(void)
{
- struct gtm_dispatch *r;
+ struct abi_dispatch *r;
asm (SEG_DECODE_READ(12) : "=r"(r));
return r;
}
-static inline void set_gtm_disp(struct gtm_dispatch *x)
+static inline void set_abi_disp(struct abi_dispatch *x)
{
void *scratch;
asm volatile (SEG_ENCODE_WRITE(12) : "=r"(scratch) : "0"(x));
@@ -86,7 +86,7 @@ extern void * xrealloc (void *p, size_t s) __attribute__((malloc, nothrow));
namespace GTM HIDDEN {
// A dispatch table parameterizes the implementation of the STM.
-struct gtm_dispatch
+struct abi_dispatch
{
public:
enum lock_type { NOLOCK, R, RaR, RaW, RfW, W, WaR, WaW };
@@ -102,8 +102,8 @@ struct gtm_dispatch
private:
// Disallow copies
- gtm_dispatch(const gtm_dispatch &) = delete;
- gtm_dispatch& operator=(const gtm_dispatch &) = delete;
+ abi_dispatch(const abi_dispatch &) = delete;
+ abi_dispatch& operator=(const abi_dispatch &) = delete;
public:
// The default version of these is pass-through. This merely gives the
@@ -129,7 +129,7 @@ struct gtm_dispatch
protected:
const bool m_read_only;
const bool m_write_through;
- gtm_dispatch(bool ro, bool wt) : m_read_only(ro), m_write_through(wt) { }
+ abi_dispatch(bool ro, bool wt) : m_read_only(ro), m_write_through(wt) { }
static gtm_cacheline_mask mask_sink;
};
@@ -287,9 +287,9 @@ extern void GTM_error (const char *fmt, ...)
extern void GTM_fatal (const char *fmt, ...)
__attribute__((noreturn, format (printf, 1, 2)));
-extern gtm_dispatch *dispatch_wbetl();
-extern gtm_dispatch *dispatch_readonly();
-extern gtm_dispatch *dispatch_serial();
+extern abi_dispatch *dispatch_wbetl();
+extern abi_dispatch *dispatch_readonly();
+extern abi_dispatch *dispatch_serial();
extern gtm_cacheline_mask gtm_mask_stack(gtm_cacheline *, gtm_cacheline_mask);
@@ -28,9 +28,9 @@ using namespace GTM;
static void
do_memcpy (uintptr_t idst, uintptr_t isrc, size_t size,
- gtm_dispatch::lock_type W, gtm_dispatch::lock_type R)
+ abi_dispatch::lock_type W, abi_dispatch::lock_type R)
{
- gtm_dispatch *disp = gtm_disp();
+ abi_dispatch *disp = abi_disp();
// The position in the destination cacheline where *IDST starts.
uintptr_t dofs = idst & (CACHELINE_SIZE - 1);
// The position in the source cacheline where *ISRC starts.
@@ -40,7 +40,7 @@ do_memcpy (uintptr_t idst, uintptr_t isrc, size_t size,
gtm_cacheline *dst
= reinterpret_cast<gtm_cacheline *>(idst & -CACHELINE_SIZE);
const gtm_cacheline *sline;
- gtm_dispatch::mask_pair dpair;
+ abi_dispatch::mask_pair dpair;
if (size == 0)
return;
@@ -177,12 +177,12 @@ do_memcpy (uintptr_t idst, uintptr_t isrc, size_t size,
static void
do_memmove (uintptr_t idst, uintptr_t isrc, size_t size,
- gtm_dispatch::lock_type W, gtm_dispatch::lock_type R)
+ abi_dispatch::lock_type W, abi_dispatch::lock_type R)
{
- gtm_dispatch *disp = gtm_disp();
+ abi_dispatch *disp = abi_disp();
uintptr_t dleft, sleft, sofs, dofs;
const gtm_cacheline *sline;
- gtm_dispatch::mask_pair dpair;
+ abi_dispatch::mask_pair dpair;
if (size == 0)
return;
@@ -194,13 +194,13 @@ do_memmove (uintptr_t idst, uintptr_t isrc, size_t size,
if (__builtin_expect (idst == isrc, 0))
{
/* If the write lock is already acquired, nothing to do. */
- if (W == gtm_dispatch::WaW)
+ if (W == abi_dispatch::WaW)
return;
/* If the destination is protected, acquire a write lock. */
- if (W != gtm_dispatch::NOLOCK)
- R = gtm_dispatch::RfW;
+ if (W != abi_dispatch::NOLOCK)
+ R = abi_dispatch::RfW;
/* Notice serial mode, where we don't acquire locks at all. */
- if (R == gtm_dispatch::NOLOCK)
+ if (R == abi_dispatch::NOLOCK)
return;
idst = isrc + size;
@@ -337,12 +337,12 @@ do_memmove (uintptr_t idst, uintptr_t isrc, size_t size,
void ITM_REGPARM _ITM_memcpy##NAME(void *dst, const void *src, size_t size) \
{ \
do_memcpy ((uintptr_t)dst, (uintptr_t)src, size, \
- gtm_dispatch::WRITE, gtm_dispatch::READ); \
+ abi_dispatch::WRITE, abi_dispatch::READ); \
} \
void ITM_REGPARM _ITM_memmove##NAME(void *dst, const void *src, size_t size) \
{ \
do_memmove ((uintptr_t)dst, (uintptr_t)src, size, \
- gtm_dispatch::WRITE, gtm_dispatch::READ); \
+ abi_dispatch::WRITE, abi_dispatch::READ); \
}
ITM_MEM_DEF(RnWt, NOLOCK, W)
@@ -27,11 +27,11 @@
using namespace GTM;
static void
-do_memset(uintptr_t idst, int c, size_t size, gtm_dispatch::lock_type W)
+do_memset(uintptr_t idst, int c, size_t size, abi_dispatch::lock_type W)
{
- gtm_dispatch *disp = gtm_disp();
+ abi_dispatch *disp = abi_disp();
uintptr_t dofs = idst & (CACHELINE_SIZE - 1);
- gtm_dispatch::mask_pair dpair;
+ abi_dispatch::mask_pair dpair;
gtm_cacheline *dst
= reinterpret_cast<gtm_cacheline *>(idst & -CACHELINE_SIZE);
@@ -70,7 +70,7 @@ do_memset(uintptr_t idst, int c, size_t size, gtm_dispatch::lock_type W)
#define ITM_MEM_DEF(WRITE) \
void ITM_REGPARM _ITM_memset##WRITE(void *dst, int c, size_t size) \
{ \
- do_memset ((uintptr_t)dst, c, size, gtm_dispatch::WRITE); \
+ do_memset ((uintptr_t)dst, c, size, abi_dispatch::WRITE); \
}
ITM_MEM_DEF(W)
@@ -28,7 +28,7 @@ namespace {
using namespace GTM;
-class readonly_dispatch : public gtm_dispatch
+class readonly_dispatch : public abi_dispatch
{
private:
gtm_version m_start;
@@ -47,7 +47,7 @@ class readonly_dispatch : public gtm_dispatch
inline
readonly_dispatch::readonly_dispatch()
- : gtm_dispatch(true, true), m_start(gtm_get_clock ())
+ : abi_dispatch(true, true), m_start(gtm_get_clock ())
{ }
@@ -70,14 +70,14 @@ readonly_dispatch::read_lock(const gtm_cacheline *line, lock_type lock)
}
}
-gtm_dispatch::mask_pair
+abi_dispatch::mask_pair
readonly_dispatch::write_lock(gtm_cacheline *line, lock_type lock)
{
switch (lock)
{
case NOLOCK:
{
- gtm_dispatch::mask_pair pair;
+ abi_dispatch::mask_pair pair;
pair.line = line;
pair.mask = &mask_sink;
return pair;
@@ -117,7 +117,7 @@ readonly_dispatch::fini ()
} // anon namespace
-gtm_dispatch *
+abi_dispatch *
GTM::dispatch_readonly ()
{
return new readonly_dispatch();
@@ -26,23 +26,23 @@
namespace GTM HIDDEN {
-gtm_cacheline_mask gtm_dispatch::mask_sink;
+gtm_cacheline_mask abi_dispatch::mask_sink;
const gtm_cacheline *
-gtm_dispatch::read_lock(const gtm_cacheline *addr, lock_type)
+abi_dispatch::read_lock(const gtm_cacheline *addr, lock_type)
{
return addr;
}
-gtm_dispatch::mask_pair
-gtm_dispatch::write_lock(gtm_cacheline *addr, lock_type)
+abi_dispatch::mask_pair
+abi_dispatch::write_lock(gtm_cacheline *addr, lock_type)
{
return mask_pair (addr, &mask_sink);
}
} // namespace GTM
-// Avoid a dependency on libstdc++ for the pure virtuals in gtm_dispatch.
+// Avoid a dependency on libstdc++ for the pure virtuals in abi_dispatch.
extern "C" void HIDDEN
__cxa_pure_virtual ()
{
@@ -53,10 +53,10 @@ using namespace GTM;
namespace {
-class serial_dispatch : public gtm_dispatch
+class serial_dispatch : public abi_dispatch
{
public:
- serial_dispatch() : gtm_dispatch(false, true) { }
+ serial_dispatch() : abi_dispatch(false, true) { }
// The read_lock and write_lock methods are implented by the base class.
@@ -71,7 +71,7 @@ class serial_dispatch : public gtm_dispatch
static const serial_dispatch o_serial_dispatch;
-gtm_dispatch *
+abi_dispatch *
GTM::dispatch_serial ()
{
return const_cast<serial_dispatch *>(&o_serial_dispatch);
@@ -82,7 +82,7 @@ GTM::dispatch_serial ()
void
GTM::gtm_transaction::serialirr_mode ()
{
- struct gtm_dispatch *disp = gtm_disp ();
+ struct abi_dispatch *disp = abi_disp ();
bool need_restart = true;
if (this->state & STATE_SERIAL)
@@ -111,7 +111,7 @@ GTM::gtm_transaction::serialirr_mode ()
else
{
this->state |= (STATE_SERIAL | STATE_IRREVOCABLE);
- set_gtm_disp (dispatch_serial ());
+ set_abi_disp (dispatch_serial ());
}
}
@@ -28,7 +28,7 @@ namespace {
using namespace GTM;
-class wbetl_dispatch : public gtm_dispatch
+class wbetl_dispatch : public abi_dispatch
{
private:
static const size_t RW_SET_SIZE = 4096;
@@ -394,7 +394,7 @@ wbetl_dispatch::read_lock (const gtm_cacheline *addr, lock_type ltype)
}
}
-gtm_dispatch::mask_pair
+abi_dispatch::mask_pair
wbetl_dispatch::write_lock (gtm_cacheline *addr, lock_type ltype)
{
gtm_cacheline *line;
@@ -547,7 +547,7 @@ wbetl_dispatch::trydropreference (void *ptr, size_t size)
gtm_cacheline *src
= reinterpret_cast<gtm_cacheline *>(isrc & -CACHELINE_SIZE);
unsigned char *dst = (unsigned char *)ptr;
- gtm_dispatch::mask_pair pair;
+ abi_dispatch::mask_pair pair;
// If we're trying to drop a reference, we should already have a
// write lock on it. If we don't have one, there's no work to do.
@@ -602,7 +602,7 @@ wbetl_dispatch::trydropreference (void *ptr, size_t size)
wbetl_dispatch::wbetl_dispatch ()
- : gtm_dispatch (false, false)
+ : abi_dispatch (false, false)
{
m_rset_entries = (r_entry *) xmalloc (RW_SET_SIZE * sizeof(r_entry));
m_rset_nb_entries = 0;
@@ -621,7 +621,7 @@ wbetl_dispatch::wbetl_dispatch ()
} // anon namespace
-gtm_dispatch *
+abi_dispatch *
GTM::dispatch_wbetl ()
{
return new wbetl_dispatch ();
@@ -27,7 +27,7 @@
void
GTM::gtm_transaction::decide_retry_strategy (gtm_restart_reason r)
{
- struct gtm_dispatch *disp = gtm_disp ();
+ struct abi_dispatch *disp = abi_disp ();
this->restart_reason[r]++;
this->restart_total++;
@@ -61,7 +61,7 @@ GTM::gtm_transaction::decide_retry_strategy (gtm_restart_reason r)
this->state = (STATE_SERIAL | STATE_IRREVOCABLE);
disp->fini ();
disp = dispatch_serial ();
- set_gtm_disp (disp);
+ set_abi_disp (disp);
}
else
{
@@ -72,7 +72,7 @@ GTM::gtm_transaction::decide_retry_strategy (gtm_restart_reason r)
{
disp->fini ();
disp = dispatch_wbetl ();
- set_gtm_disp (disp);
+ set_abi_disp (disp);
return;
}
}