tlds
Transactional Operations for Linked Data Structures
|
#include <setjmp.h>
#include <stm/config.h>
#include <common/platform.hpp>
#include <stm/txthread.hpp>
#include "library_inst.hpp"
Go to the source code of this file.
Classes | |
struct | stm::Object |
Namespaces | |
stm | |
Macros | |
#define | TM_BECOME_IRREVOC() stm::become_irrevoc() |
#define | TM_READ(var) stm::stm_read(&var, tx) |
#define | TM_WRITE(var, val) stm::stm_write(&var, val, tx) |
#define | TM_BEGIN(TYPE) |
#define | TM_END |
#define | TM_GET_THREAD() stm::TxThread* tx = (stm::TxThread*)stm::Self |
#define | TM_ARG_ALONE stm::TxThread* tx |
#define | TM_ARG , TM_ARG_ALONE |
#define | TM_PARAM , tx |
#define | TM_PARAM_ALONE tx |
#define | TM_WAIVER |
#define | TM_CALLABLE |
#define | TM_SYS_INIT() stm::sys_init() |
#define | TM_THREAD_INIT stm::thread_init |
#define | TM_THREAD_SHUTDOWN() stm::thread_shutdown() |
#define | TM_SYS_SHUTDOWN stm::sys_shutdown |
#define | TM_ALLOC stm::tx_alloc |
#define | TM_FREE stm::tx_free |
#define | TM_SET_POLICY(P) stm::set_policy(P) |
#define | TM_GET_ALGNAME() stm::get_algname() |
#define | TM_BEGIN_FAST_INITIALIZATION() |
#define | TM_END_FAST_INITIALIZATION() TM_SET_POLICY(__config_string__) |
Functions | |
TM_INLINE void | stm::begin (TxThread *tx, scope_t *s, uint32_t) |
TM_INLINE void | stm::commit (TxThread *tx) |
void NORETURN | stm::UNRECOVERABLE (const char *) |
void * | stm::tx_alloc (size_t size) |
void | stm::tx_free (void *p) |
void | stm::sys_init (void(*abort_handler)(TxThread *)=NULL) |
void | stm::sys_shutdown () |
void | stm::thread_init () |
void | stm::thread_shutdown () |
void | stm::set_policy (const char *) |
const char * | stm::get_algname () |
bool | stm::become_irrevoc (STM_WHEN_PROTECT_STACK(void **top_of_stack)) |
void | stm::restart () |
template<typename T > | |
T | stm::stm_read (T *addr, TxThread *thread) |
template<typename T > | |
void | stm::stm_write (T *addr, T val, TxThread *thread) |
#define TM_ALLOC stm::tx_alloc |
#define TM_ARG , TM_ARG_ALONE |
#define TM_ARG_ALONE stm::TxThread* tx |
#define TM_BECOME_IRREVOC | ( | ) | stm::become_irrevoc() |
#define TM_BEGIN | ( | TYPE | ) |
This is the way to start a transaction
#define TM_BEGIN_FAST_INITIALIZATION | ( | ) |
This is gross. ITM, like any good compiler, will make nontransactional versions of code so that we can cleanly do initialization from outside of a transaction. The library can do this, but only via some cumbersome template games that we really don't want to keep playing (see the previous release for examples).
Since we don't want to have transactional configuration (it is slow, and it messes up some accounting of commits and transaction sizes), we use the following trick: if we aren't using a compiler for instrumentation, then BEGIN_FAST_INITIALIZATION will copy the current STM configuration (envar STM_CONFIG) to a local, then switch the mode to CGL, then call the instrumented functions using CGL instrumentation (e.g., the lightest possible, and correct without a 'commit'). Likewise, if we aren't using a compiler for instrumentation, then END_FAST_INITIALIZATION will restore the original configuration, so that the app will use the STM as expected.
#define TM_CALLABLE |
#define TM_END |
This is the way to commit a transaction. Note that these macros weakly enforce lexical scoping
#define TM_END_FAST_INITIALIZATION | ( | ) | TM_SET_POLICY(__config_string__) |
#define TM_FREE stm::tx_free |
#define TM_GET_ALGNAME | ( | ) | stm::get_algname() |
#define TM_GET_THREAD | ( | ) | stm::TxThread* tx = (stm::TxThread*)stm::Self |
Macro to get STM context. This currently produces a pointer to a TxThread
#define TM_PARAM , tx |
#define TM_PARAM_ALONE tx |
#define TM_READ | ( | var | ) | stm::stm_read(&var, tx) |
Code should only use these calls, not the template stuff declared above
#define TM_SET_POLICY | ( | P | ) | stm::set_policy(P) |
#define TM_SYS_INIT | ( | ) | stm::sys_init() |
#define TM_SYS_SHUTDOWN stm::sys_shutdown |
#define TM_THREAD_INIT stm::thread_init |
#define TM_THREAD_SHUTDOWN | ( | ) | stm::thread_shutdown() |
#define TM_WAIVER |
#define TM_WRITE | ( | var, | |
val | |||
) | stm::stm_write(&var, val, tx) |