#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <setjmp.h>
#include <signal.h>
#include <amino/config.h>
#include "atomic.h"
#include "stm.h"
#include "stm_rw.h"
Classes | |
union | orec |
struct | meta_entry |
struct | read_entry |
union | value |
struct | write_entry |
struct | checkpoint_entry |
struct | desc |
Defines | |
#define | false 0 |
#define | true 1 |
#define | DEBUG_PRINT if (debug) printf |
#define | ASSERT(x) assert(x) |
#define | MMAP(size) mmap(0,size,PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0) |
#define | STATS_ADD(var, val) |
#define | STATS_MAX(var, val) |
#define | PROF_START_TIME() |
#define | PROF_END_TIME() |
#define | DEFAULT_LOG_2_BLOOM_FILTER_BITS 9 |
#define | DEFAULT_LOG_2_NUM_ORECS 20 |
#define | DEFAULT_LOG_2_BLOCK_SIZE 3 |
#define | MIN_LOG_2_BLOOM_FILTER_BITS 6 |
#define | MIN_LOG_2_NUM_ORECS 10 |
#define | MIN_LOG_2_BLOCK_SIZE 3 |
#define | LOG_2_BLOOM_FILTER_BITS DEFAULT_LOG_2_BLOOM_FILTER_BITS |
#define | LOG_2_NUM_ORECS DEFAULT_LOG_2_NUM_ORECS |
#define | LOG_2_BLOCK_SIZE DEFAULT_LOG_2_BLOCK_SIZE |
#define | DEFAULT_RETRY_THRESHOLD 10 |
#define | RETRY_THRESHOLD DEFAULT_RETRY_THRESHOLD |
#define | DEFAULT_MAX_TXNS 64 |
#define | MAX_TXNS DEFAULT_MAX_TXNS |
#define | TX_INACTIVE 0 |
#define | TX_ACTIVE 1 |
#define | TX_ABORTED 2 |
#define | TX_DOOMED 3 |
#define | TX_COMMITTED 4 |
#define | RETRY_EX 1 |
#define | INITIAL_READ_LIST 64 |
#define | INITIAL_WRITE_LIST 16 |
#define | INITIAL_MALLOC_LIST 16 |
#define | INITIAL_FREE_LIST 16 |
#define | INITIAL_CHECKPOINT_LIST 16 |
#define | BLOOM_FILTER_BITS (1<<LOG_2_BLOOM_FILTER_BITS) |
#define | BLOOM_FILTER_MASK (BLOOM_FILTER_BITS-1) |
#define | WRITE_TO_NEW_OREC 0 |
#define | WRITE_TO_OLD_OREC 1 |
#define | WRITE_TO_OLD_BUFFER 2 |
#define | WRITE_TO_MEMORY 3 |
#define | WRITE_CONFLICT 4 |
#define | END_OF_LIST -1 |
#define | extern |
#define | STM_NOT_INITIALIZED 0 |
#define | STM_BEING_INITIALIZED 1 |
#define | STM_INITIALIZED 2 |
#define | lognumorecs LOG_2_NUM_ORECS |
#define | numorecs (1<<lognumorecs) |
#define | blockbits LOG_2_BLOCK_SIZE |
#define | blockmask ((1<<(lognumorecs+blockbits))-1) |
#define | TLS_INIT() { tls_my = NULL; } |
#define | TLS_SET(x) tls_my = (x) |
#define | TLS_GET() tls_my |
#define | STM_VALIDATE_READ_SET(my) stm_validate_read_set(my) |
#define | ITEM_TYPE write_entry_t |
#define | SORT_FIELD pmeta |
Typedefs | |
typedef union orec | orec_t |
typedef struct meta_entry | meta_entry_t |
typedef struct read_entry | read_entry_t |
typedef union value | value_t |
typedef struct write_entry | write_entry_t |
typedef struct checkpoint_entry | checkpoint_entry_t |
typedef struct desc | desc_t |
typedef void | stm_end_ret_t |
Functions | |
NOINLINE desc_t * | desc_alloc () |
NOINLINE void | desc_free (desc_t *desc) |
INLINE void | common_cleanup (desc_t *my) |
NOINLINE void | undo_write_locks (desc_t *my) |
NOINLINE void | wait_for_orec_change (desc_t *my, meta_entry_t volatile *pmeta, void *orecall) |
NOINLINE void | cleanup_on_abort (desc_t *my) |
void | stm_retry (void *mydesc) |
void | stm_init () |
void * | stm_thr_init () |
void | stm_thr_retire () |
NOINLINE void | expand_reads (desc_t *my) |
NOINLINE void | expand_writes (desc_t *my) |
INLINE int | stm_in_transaction () |
INLINE void | stm_stack_range (void *const addr, int size, void *mydesc) |
INLINE void | stm_check_forxlc () |
INLINE void * | stm_desc () |
INLINE void | stm_begin (jmp_buf buf, void *mydesc, char *fname, int line) |
void | stm_abort () |
void | stm_validate (void *mydesc) |
NOINLINE void | expand_malloc_list (desc_t *my) |
NOINLINE void | expand_free_list (desc_t *my) |
NOINLINE void | expand_checkpoint_list (desc_t *my) |
void * | stm_malloc (size_t sz, void *mydesc) |
void * | stm_calloc (size_t ne, size_t sz, void *mydesc) |
void | stm_free (void *ptr, void *mydesc) |
INLINE void | stm_checkpoint (char *const addr, int size, void *mydesc) |
NOINLINE write_entry_t * | search_write_list (desc_t *my, void *const addr) |
NOINLINE write_entry_t * | get_write_entry (desc_t *my, void *const addr) |
void | stm_read_block (char *to, char volatile *from, int count, void *mydesc) |
void | stm_write_block (char volatile *to, char *from, int count, void *mydesc) |
void | stm_set_block (char volatile *const addr, int c, int count, void *mydesc) |
INLINE stm_end_ret_t | stm_end (void *mydesc) |
NOINLINE void | print_orec (void *key) |
NOINLINE void | stm_debug_on () |
unsigned | sum_orecs () |
void | stm_print_time_prof () |
void | stm_print_stats () |
void | stm_stats_out () |
void | stm_retire () |
Variables | |
meta_entry_t | meta [numorecs] |
__thread desc_t * | tls_my = NULL |
#define ASSERT | ( | x | ) | assert(x) |
#define blockbits LOG_2_BLOCK_SIZE |
#define blockmask ((1<<(lognumorecs+blockbits))-1) |
#define BLOOM_FILTER_BITS (1<<LOG_2_BLOOM_FILTER_BITS) |
#define BLOOM_FILTER_MASK (BLOOM_FILTER_BITS-1) |
#define DEBUG_PRINT if (debug) printf |
#define DEFAULT_LOG_2_BLOCK_SIZE 3 |
#define DEFAULT_LOG_2_BLOOM_FILTER_BITS 9 |
#define DEFAULT_LOG_2_NUM_ORECS 20 |
#define DEFAULT_MAX_TXNS 64 |
#define DEFAULT_RETRY_THRESHOLD 10 |
#define END_OF_LIST -1 |
#define extern |
#define false 0 |
#define INITIAL_CHECKPOINT_LIST 16 |
#define INITIAL_FREE_LIST 16 |
#define INITIAL_MALLOC_LIST 16 |
#define INITIAL_READ_LIST 64 |
#define INITIAL_WRITE_LIST 16 |
#define ITEM_TYPE write_entry_t |
#define LOG_2_BLOCK_SIZE DEFAULT_LOG_2_BLOCK_SIZE |
#define LOG_2_BLOOM_FILTER_BITS DEFAULT_LOG_2_BLOOM_FILTER_BITS |
#define LOG_2_NUM_ORECS DEFAULT_LOG_2_NUM_ORECS |
#define lognumorecs LOG_2_NUM_ORECS |
#define MAX_TXNS DEFAULT_MAX_TXNS |
#define MIN_LOG_2_BLOCK_SIZE 3 |
#define MIN_LOG_2_BLOOM_FILTER_BITS 6 |
#define MIN_LOG_2_NUM_ORECS 10 |
#define MMAP | ( | size | ) | mmap(0,size,PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0) |
#define numorecs (1<<lognumorecs) |
#define PROF_END_TIME | ( | ) |
#define PROF_START_TIME | ( | ) |
#define RETRY_EX 1 |
#define RETRY_THRESHOLD DEFAULT_RETRY_THRESHOLD |
#define SORT_FIELD pmeta |
#define STATS_ADD | ( | var, | |||
val | ) |
#define STATS_MAX | ( | var, | |||
val | ) |
#define STM_BEING_INITIALIZED 1 |
#define STM_INITIALIZED 2 |
#define STM_NOT_INITIALIZED 0 |
#define STM_VALIDATE_READ_SET | ( | my | ) | stm_validate_read_set(my) |
#define TLS_GET | ( | ) | tls_my |
#define TLS_INIT | ( | ) | { tls_my = NULL; } |
#define TLS_SET | ( | x | ) | tls_my = (x) |
#define true 1 |
#define TX_ABORTED 2 |
#define TX_ACTIVE 1 |
#define TX_COMMITTED 4 |
#define TX_DOOMED 3 |
#define TX_INACTIVE 0 |
#define WRITE_CONFLICT 4 |
#define WRITE_TO_MEMORY 3 |
#define WRITE_TO_NEW_OREC 0 |
#define WRITE_TO_OLD_BUFFER 2 |
#define WRITE_TO_OLD_OREC 1 |
typedef struct checkpoint_entry checkpoint_entry_t |
typedef struct meta_entry meta_entry_t |
typedef struct read_entry read_entry_t |
typedef void stm_end_ret_t |
typedef struct write_entry write_entry_t |
NOINLINE void cleanup_on_abort | ( | desc_t * | my | ) |
INLINE void common_cleanup | ( | desc_t * | my | ) |
NOINLINE desc_t * desc_alloc | ( | ) |
static void desc_free | ( | desc_t * | desc | ) |
NOINLINE void expand_checkpoint_list | ( | desc_t * | my | ) |
NOINLINE void expand_free_list | ( | desc_t * | my | ) |
NOINLINE void expand_malloc_list | ( | desc_t * | my | ) |
NOINLINE void expand_reads | ( | desc_t * | my | ) |
NOINLINE void expand_writes | ( | desc_t * | my | ) |
NOINLINE write_entry_t* get_write_entry | ( | desc_t * | my, | |
void *const | addr | |||
) |
NOINLINE void print_orec | ( | void * | key | ) |
for debugging
NOINLINE write_entry_t* search_write_list | ( | desc_t * | my, | |
void *const | addr | |||
) |
void stm_abort | ( | ) |
INLINE void stm_begin | ( | jmp_buf | buf, | |
void * | mydesc, | |||
char * | fname, | |||
int | line | |||
) |
void* stm_calloc | ( | size_t | ne, | |
size_t | sz, | |||
void * | mydesc | |||
) |
INLINE void stm_check_forxlc | ( | ) |
INLINE void stm_checkpoint | ( | char *const | addr, | |
int | size, | |||
void * | mydesc | |||
) |
NOINLINE void stm_debug_on | ( | ) |
INLINE void* stm_desc | ( | ) |
INLINE stm_end_ret_t stm_end | ( | void * | mydesc | ) |
void stm_free | ( | void * | ptr, | |
void * | mydesc | |||
) |
INLINE int stm_in_transaction | ( | ) |
void stm_init | ( | ) |
void* stm_malloc | ( | size_t | sz, | |
void * | mydesc | |||
) |
void stm_print_stats | ( | ) |
void stm_print_time_prof | ( | ) |
void stm_read_block | ( | char * | to, | |
char volatile * | from, | |||
int | count, | |||
void * | mydesc | |||
) |
void stm_retire | ( | ) |
void stm_retry | ( | void * | mydesc | ) |
void stm_set_block | ( | char volatile *const | addr, | |
int | c, | |||
int | count, | |||
void * | mydesc | |||
) |
INLINE void stm_stack_range | ( | void *const | addr, | |
int | size, | |||
void * | mydesc | |||
) |
void stm_stats_out | ( | ) |
void* stm_thr_init | ( | ) |
void stm_thr_retire | ( | ) |
void stm_validate | ( | void * | mydesc | ) |
void stm_write_block | ( | char volatile * | to, | |
char * | from, | |||
int | count, | |||
void * | mydesc | |||
) |
unsigned sum_orecs | ( | ) |
NOINLINE void undo_write_locks | ( | desc_t * | my | ) |
NOINLINE void wait_for_orec_change | ( | desc_t * | my, | |
meta_entry_t volatile * | pmeta, | |||
void * | orecall | |||
) |
meta_entry_t meta[numorecs] |