19 #include <stm/config.h>
28 #include "../profiling.hpp"
147 uintptr_t index =
reinterpret_cast<uintptr_t
>(addr);
157 uintptr_t index =
reinterpret_cast<uintptr_t
>(addr);
167 uintptr_t index =
reinterpret_cast<uintptr_t
>(addr);
177 uintptr_t index =
reinterpret_cast<uintptr_t
>(addr);
187 uintptr_t index =
reinterpret_cast<uintptr_t
>(addr);
226 delay &= ((1 << bits)-1);
228 unsigned long long start = getElapsedTime();
229 unsigned long long stop_at = start + delay;
230 while (getElapsedTime() < stop_at) {
spin64(); }
250 Trigger::onCommitSTM(tx);
259 Trigger::onCommitSTM(tx);
268 Trigger::onCommitSTM(tx);
275 Trigger::onCommitLock(tx);
282 Trigger::onCommitLock(tx);
307 Trigger::onAbort(tx);
317 Trigger::onAbort(tx);
369 return (tx->
tmread == read_turbo);
384 #if defined(STM_CPU_SPARC)
387 atomicswap8(&
reader[
id], 1u);
395 uintptr_t mask = 1lu<<(slot %
BITS);
400 if (bcasptr(&
bits[bucket], oldval, (oldval | mask)))
410 uintptr_t mask = 1lu<<(slot %
BITS);
412 return oldval & mask;
419 uintptr_t mask = 1lu<<(slot %
BITS);
420 uintptr_t unmask = ~mask;
422 if (!(oldval & mask))
425 #if defined(STM_CPU_X86) && defined(STM_CC_GCC)
426 __sync_fetch_and_and(&
bits[bucket], unmask);
429 if (bcasptr(&
bits[bucket], oldval, (oldval & unmask)))
440 uintptr_t mask = 1lu<<(slot %
BITS);
446 #if defined(STM_CPU_X86) && defined(STM_CC_GCC)
447 __sync_fetch_and_or(&
bits[bucket], mask);
451 if (bcasptr(&
bits[bucket], oldval, oldval | mask))
463 for (
unsigned i = 0; i <
BUCKETS; ++i)
484 printf(
"abort_histogram: ");
485 for (
int i = 0; i < 18; ++i)
void spin64()
Definition: locks.hpp:36
#define STM_WRITE_SIG(tx, addr, val, mask)
Definition: macros.hpp:85
static const uint32_t RREC_COUNT
Definition: algs.hpp:61
ALGS
Definition: algs.hpp:35
bool privatization_safe
Definition: algs.hpp:130
dynprof_t * profiles
Definition: algs.cpp:78
void onTxAbort()
Definition: WBMMPolicy.hpp:150
static const uint32_t BACKOFF_MAX
Definition: algs.hpp:60
static void * start(jsw_avltrav_t *trav, jsw_avltree_t *tree, long dir)
Definition: avltree.c:681
uint32_t buckets[18]
Definition: metadata.hpp:205
Definition: metadata.hpp:115
void setbit(unsigned slot)
Definition: algs.hpp:392
Definition: stm_fraser.c:61
TM_INLINE rrec_t * get_rrec(void *addr)
Definition: algs.hpp:165
bool(* TM_FASTCALL)(TxThread *)
Definition: algs.hpp:107
TM_FASTCALL void * read(STM_READ_SIG(,,))
bool getbit(unsigned slot)
Definition: algs.hpp:407
TRANSACTION_SAFE int bucket(const point *const p)
Definition: point.hpp:153
uint32_t profile_txns
Definition: algs.cpp:77
TM_FASTCALL bool begin_CGL(TxThread *)
Definition: cgl.cpp:127
TM_INLINE void exp_backoff(TxThread *tx)
Definition: algs.hpp:218
#define STM_READ_SIG(tx, addr, mask)
Definition: macros.hpp:84
uint32_t max
Definition: metadata.hpp:196
uint32_t seed
Definition: txthread.hpp:72
Definition: metadata.hpp:97
void OnCGLCommit(TxThread *tx)
Definition: algs.hpp:271
scope_t * PostRollbackNoTrigger(TxThread *tx, stm::ReadBarrier r, stm::WriteBarrier w, stm::CommitBarrier c)
Definition: algs.hpp:330
Definition: metadata.hpp:128
void OnReadOnlyCGLCommit(TxThread *tx)
Definition: algs.hpp:278
void onCommit(uint32_t aborts)
Definition: algs.hpp:468
bool setif(unsigned slot)
Definition: algs.hpp:437
TM_INLINE orec_t * get_orec(void *addr)
Definition: algs.hpp:145
TM_FASTCALL void write(STM_WRITE_SIG(,,,))
#define STM_IRREVOC_SIG(tx, stack)
Definition: macros.hpp:93
void onCommit(uint32_t)
Definition: metadata.hpp:233
Definition: policies.hpp:92
pad_word_t fcm_timestamp
Definition: algs.cpp:68
TM_FASTCALL void *(* ReadBarrier)(STM_READ_SIG(,,))
Definition: algs.hpp:236
mcs_qnode_t * mcslock
Definition: algs.cpp:62
void OnReadWriteCommit(TxThread *tx, ReadBarrier read_ro, WriteBarrier write_ro, CommitBarrier commit_ro)
Definition: algs.hpp:240
volatile unsigned char reader[CACHELINE_BYTES-sizeof(uint32_t)]
Definition: metadata.hpp:100
scope_t *volatile scope
Definition: txthread.hpp:57
Definition: metadata.hpp:157
TM_INLINE void begin(TxThread *tx, scope_t *s, uint32_t)
Definition: library.hpp:71
pad_word_t epochs[MAX_THREADS]
Definition: algs.cpp:56
alg_t()
Definition: algs.hpp:133
static const uint32_t WB_CHUNK_SIZE
Definition: algs.hpp:62
int rand_r_32(unsigned int *seed)
Definition: rand_r_32.h:43
void onHGAbort()
Definition: algs.hpp:492
uint32_t hg_aborts
Definition: metadata.hpp:202
void(* switcher)()
Definition: algs.hpp:122
bitlock_t bitlocks[NUM_STRIPES]
Definition: algs.cpp:53
TM_INLINE void commit(TxThread *tx)
Definition: library.hpp:104
scope_t * PostRollback(TxThread *tx, ReadBarrier read_ro, WriteBarrier write_ro, CommitBarrier commit_ro)
Definition: algs.hpp:299
uint32_t num_ro
Definition: txthread.hpp:56
uint32_t num_aborts
Definition: txthread.hpp:54
static const uint32_t BACKOFF_MIN
Definition: algs.hpp:59
TM_FASTCALL void(* tmcommit)(STM_COMMIT_SIG(,))
Definition: txthread.hpp:118
TM_FASTCALL void *(* tmread)(STM_READ_SIG(,,))
Definition: txthread.hpp:119
void set_read_byte(uint32_t id)
Definition: algs.hpp:382
toxic_t abort_hist
Definition: txthread.hpp:86
void OnFirstWrite(TxThread *tx, ReadBarrier read_rw, WriteBarrier write_rw, CommitBarrier commit_rw)
Definition: algs.hpp:285
orec_t orecs[NUM_STRIPES]
Definition: algs.cpp:35
#define STM_COMMIT_SIG(tx, stack)
Definition: macros.hpp:92
void scope_t
Definition: metadata.hpp:39
void operator|=(rrec_t &rhs)
Definition: algs.hpp:459
WBMMPolicy allocator
Definition: txthread.hpp:52
static const uint32_t KARMA_FACTOR
Definition: algs.hpp:58
ticket_lock_t ticketlock
Definition: algs.cpp:65
int stm_name_map(const char *phasename)
Definition: algs.cpp:81
void GoTurbo(TxThread *tx, ReadBarrier r, WriteBarrier w, CommitBarrier c)
Definition: algs.hpp:359
stm_tx * tx
Definition: stmskip.cc:245
volatile uintptr_t bits[BUCKETS]
Definition: metadata.hpp:133
pad_word_t prioTxCount
Definition: algs.cpp:46
TM_INLINE bytelock_t * get_bytelock(void *addr)
Definition: algs.hpp:175
TM_INLINE bitlock_t * get_bitlock(void *addr)
Definition: algs.hpp:185
dynprof_t * app_profiles
Definition: algs.cpp:74
void PreRollback(TxThread *tx)
Definition: algs.hpp:293
uint32_t num_commits
Definition: txthread.hpp:53
uint32_t consec_aborts
Definition: txthread.hpp:71
pad_word_t last_init
Definition: algs.cpp:42
uint32_t nesting_depth
Definition: txthread.hpp:51
static const uint32_t ACTIVE
Definition: algs.hpp:64
bool CheckTurboMode(TxThread *tx, ReadBarrier read_turbo)
Definition: algs.hpp:367
void OnReadOnlyCommit(TxThread *tx)
Definition: algs.hpp:262
bytelock_t bytelocks[NUM_STRIPES]
Definition: algs.cpp:50
TM_INLINE orec_t * get_nanorec(void *addr)
Definition: algs.hpp:155
Definition: txthread.hpp:47
TM_FASTCALL void(* CommitBarrier)(STM_COMMIT_SIG(,))
Definition: algs.hpp:238
bool(* irrevoc)(STM_IRREVOC_SIG(,))
Definition: algs.hpp:119
static const unsigned MAX_THREADS
Definition: metadata.hpp:33
TM_FASTCALL void(* WriteBarrier)(STM_WRITE_SIG(,,,))
Definition: algs.hpp:237
const char * name
Definition: algs.hpp:101
rrec_t rrecs[RREC_COUNT]
Definition: algs.cpp:47
static const uint32_t EPOCH_MAX
Definition: algs.hpp:63
#define STM_ROLLBACK_SIG(tx, stack, exception, len)
Definition: macros.hpp:106
pad_word_t greedy_ts
Definition: algs.cpp:59
orec_t nanorecs[RING_ELEMENTS]
Definition: algs.cpp:38
TM_FASTCALL void(* tmwrite)(STM_WRITE_SIG(,,,))
Definition: txthread.hpp:120
static const uint32_t RING_ELEMENTS
Definition: algs.hpp:57
pad_word_t last_complete
Definition: algs.cpp:41
static const uint32_t SWISS_PHASE2
Definition: algs.hpp:66
static const uint32_t ABORTED
Definition: algs.hpp:65
void onTxCommit()
Definition: WBMMPolicy.hpp:161
Definition: metadata.hpp:72
union stm::id_version_t TM_ALIGN
uint32_t hg_commits
Definition: metadata.hpp:199
static const uint32_t BUCKETS
Definition: metadata.hpp:131
void unsetbit(unsigned slot)
Definition: algs.hpp:416
Definition: BitFilter.hpp:36
Definition: locks.hpp:112
static const uint32_t NUM_STRIPES
Definition: algs.hpp:56
pad_word_t timestamp_max
Definition: algs.cpp:32
void onHGCommit()
Definition: algs.hpp:491
alg_t stms[ALG_MAX]
Definition: algs.cpp:71
void dump()
Definition: algs.hpp:482
pad_word_t timestamp
Definition: algs.cpp:22
static const uint32_t BITS
Definition: metadata.hpp:132