tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
stm::WriteSet Class Reference

#include <WriteSet.hpp>

Collaboration diagram for stm::WriteSet:

Classes

struct  index_t
 

Public Types

typedef WriteSetEntry * iterator
 

Public Member Functions

 WriteSet (const size_t initial_capacity)
 
 ~WriteSet ()
 
bool find (WriteSetEntry &log) const
 
void rollback ()
 
TM_INLINE void writeback ()
 
void insert (const WriteSetEntry &log)
 
size_t size () const
 
void reset ()
 
iterator begin () const
 
iterator end () const
 

Private Member Functions

size_t hash (void *const key) const
 
size_t doubleIndexLength ()
 
void rebuild ()
 
void resize ()
 
void reset_internal ()
 

Private Attributes

index_tindex
 
size_t shift
 
size_t ilength
 
size_t version
 
WriteSetEntry * list
 
size_t capacity
 
size_t lsize
 

Detailed Description

Pick a write-set implementation, based on the configuration. The write set is an indexed array of WriteSetEntry elements. As with MiniVector, we make sure that certain expensive but rare functions are never inlined.

Member Typedef Documentation

typedef WriteSetEntry* stm::WriteSet::iterator

Constructor & Destructor Documentation

stm::WriteSet::WriteSet ( const size_t  initial_capacity)

Here is the call graph for this function:

stm::WriteSet::~WriteSet ( )

Member Function Documentation

iterator stm::WriteSet::begin ( ) const
inline

Here is the caller graph for this function:

size_t stm::WriteSet::doubleIndexLength ( )
inlineprivate

This doubles the size of the index. This does not do anything as far as actually doing memory allocation. Callers should delete[] the index table, increment the table size, and then reallocate it.

Here is the caller graph for this function:

iterator stm::WriteSet::end ( ) const
inline

Here is the caller graph for this function:

bool stm::WriteSet::find ( WriteSetEntry &  log) const
inline

Search function. The log is an in/out parameter, and the bool tells if the search succeeded. When we are byte-logging, the log's mask is updated to reflect the bytes in the returned value that are valid. In the case that we don't find anything, the mask is set to 0.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t stm::WriteSet::hash ( void *const  key) const
inlineprivate

hash function is straight from CLRS (that's where the magic constant comes from).

Here is the caller graph for this function:

void stm::WriteSet::insert ( const WriteSetEntry &  log)
inline

Inserts an entry in the write set. Coalesces writes, which can appear as write reordering in a data-racy program.

Here is the call graph for this function:

void stm::WriteSet::rebuild ( )
private

Supporting functions for resizing. Note that these are never inlined.

Here is the call graph for this function:

Here is the caller graph for this function:

void stm::WriteSet::reset ( )
inline

We use the version number to reset in O(1) time in the common case

Here is the call graph for this function:

Here is the caller graph for this function:

void stm::WriteSet::reset_internal ( )
private

Here is the caller graph for this function:

void stm::WriteSet::resize ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void stm::WriteSet::rollback ( )
inline

Support for abort-on-throw and stack protection makes rollback tricky. We might need to write to an exception object, and/or filter writeback to protect the stack.

NB: We use a macro to hide the fact that some rollback calls are really simple. This gets called by ~30 STM implementations

size_t stm::WriteSet::size ( ) const
inline

Here is the caller graph for this function:

TM_INLINE void stm::WriteSet::writeback ( )
inline

Encapsulate writeback in this routine, so that we can avoid making modifications to lots of STMs when we need to change writeback for a particular compiler.

Here is the call graph for this function:

Member Data Documentation

size_t stm::WriteSet::capacity
private
size_t stm::WriteSet::ilength
private
index_t* stm::WriteSet::index
private
WriteSetEntry* stm::WriteSet::list
private
size_t stm::WriteSet::lsize
private
size_t stm::WriteSet::shift
private
size_t stm::WriteSet::version
private

The documentation for this class was generated from the following files: