tlds
Transactional Operations for Linked Data Structures
|
#include <WriteSet.hpp>
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_t * | index |
size_t | shift |
size_t | ilength |
size_t | version |
WriteSetEntry * | list |
size_t | capacity |
size_t | lsize |
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.
typedef WriteSetEntry* stm::WriteSet::iterator |
stm::WriteSet::WriteSet | ( | const size_t | initial_capacity | ) |
stm::WriteSet::~WriteSet | ( | ) |
|
inline |
|
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.
|
inline |
|
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.
|
inlineprivate |
hash function is straight from CLRS (that's where the magic constant comes from).
|
inline |
Inserts an entry in the write set. Coalesces writes, which can appear as write reordering in a data-racy program.
|
private |
Supporting functions for resizing. Note that these are never inlined.
|
inline |
We use the version number to reset in O(1) time in the common case
|
private |
|
private |
|
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
|
inline |
|
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.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |