X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=datarace.h;h=627b8cc88c7016b27cc2660bdebdf4693e674c40;hb=24edf5ea28ecd116c1faa76ed41de1cfbf6d6d1e;hp=ef1ef8ca4a256eeaede006d24c7c806fa5844103;hpb=d2f35798cdae344760a0cc7f22dd5adc9cbc7081;p=model-checker.git diff --git a/datarace.h b/datarace.h index ef1ef8c..627b8cc 100644 --- a/datarace.h +++ b/datarace.h @@ -1,7 +1,16 @@ +/** @file datarace.h + * @brief Data race detection code. + */ + #ifndef DATARACE_H #include "config.h" #include -#include "clockvector.h" +#include +#include "modeltypes.h" + +/* Forward declaration */ +class ClockVector; +class ModelAction; struct ShadowTable { void * array[65536]; @@ -11,15 +20,36 @@ struct ShadowBaseTable { uint64_t array[65536]; }; +struct DataRace { + /* Clock and thread associated with first action. This won't change in + response to synchronization. */ + + thread_id_t oldthread; + modelclock_t oldclock; + /* Record whether this is a write, so we can tell the user. */ + bool isoldwrite; + + /* Model action associated with second action. This could change as + a result of synchronization. */ + ModelAction *newaction; + /* Record whether this is a write, so we can tell the user. */ + bool isnewwrite; + + /* Address of data race. */ + void *address; +}; + #define MASK16BIT 0xffff void initRaceDetector(); void raceCheckWrite(thread_id_t thread, void *location, ClockVector *currClock); void raceCheckRead(thread_id_t thread, void *location, ClockVector *currClock); +bool checkDataRaces(); +void printRace(struct DataRace *race); +extern std::vector unrealizedraces; - -/** Encoding idea: +/** Basic encoding idea: * (void *) Either: * (1) points to a full record or *