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

#include <ValueList.hpp>

Collaboration diagram for stm::ByteLoggingValueListEntry:

Public Member Functions

 ByteLoggingValueListEntry (void **a, void *v, uintptr_t m)
 
bool isValid () const
 

Private Attributes

void ** addr
 
void * val
 
uintptr_t mask
 

Detailed Description

When we're byte-logging we store a third word, the mask, and use it in the isValid() operation. The value we store is stored in masked form, which is an extra operation of overhead for single-threaded execution, but saves us masking during validation.

Constructor & Destructor Documentation

stm::ByteLoggingValueListEntry::ByteLoggingValueListEntry ( void **  a,
void *  v,
uintptr_t  m 
)
inline

Member Function Documentation

bool stm::ByteLoggingValueListEntry::isValid ( ) const
inline

When we're dealing with byte-granularity we need to check values on a per-byte basis.

We believe that this implementation is safe because the logged address is always word aligned, thus promoting subword loads to aligned word loads followed by a masking operation will not cause any undesired HW behavior (page fault, etc.).

We're also assuming that the masking operation means that any potential "low-level" race that we introduce is immaterial—this may or may not be safe in C++1X. As an example, someone is nontransactionally writing the first byte of a word and we're transactionally reading the scond byte. There is no language-level race, however when we promote the transactional byte read to a word, we read the same location the nontransactional access is writing, and there is no intervening synchronization. We're safe from some bad behavior because of the atomicity of word-level accesses, and we mask out the first byte, which means the racing read was actually dead. There are no executions where the source program can observe the race and thus they conclude that it is race-free.

I don't know if this argument is valid, but it is certainly valid for now, since there is no memory model for C/C++.

If this becomes a problem we can switch to a loop-when-mask != ~0x0 approach.

Member Data Documentation

void** stm::ByteLoggingValueListEntry::addr
private
uintptr_t stm::ByteLoggingValueListEntry::mask
private
void* stm::ByteLoggingValueListEntry::val
private

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