datarace: change "Datarace" to "Data race"
[c11tester.git] / datarace.cc
index 732d6ff748b6e77187c10f0bf5dcd6b6b834b025..448929b295641d7546cdcdbf7524ae69b206b43f 100644 (file)
@@ -32,7 +32,7 @@ void * table_calloc(size_t size) {
 
 /** This function looks up the entry in the shadow table corresponding to a
  * given address.*/
-static uint64_t * lookupAddressEntry(void * address) {
+static uint64_t * lookupAddressEntry(const void * address) {
        struct ShadowTable *currtable=root;
 #if BIT48
        currtable=(struct ShadowTable *) currtable->array[(((uintptr_t)address)>>32)&MASK16BIT];
@@ -91,7 +91,7 @@ static void expandRecord(uint64_t * shadow) {
 }
 
 /** This function is called when we detect a data race.*/
-static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool isoldwrite, ModelAction *newaction, bool isnewwrite, void *address) {
+static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool isoldwrite, ModelAction *newaction, bool isnewwrite, const void *address) {
        struct DataRace *race = (struct DataRace *)snapshot_malloc(sizeof(struct DataRace));
        race->oldthread=oldthread;
        race->oldclock=oldclock;
@@ -102,10 +102,8 @@ static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool is
        unrealizedraces.push_back(race);
 
        /* If the race is realized, bail out now. */
-       if (checkDataRaces()) {
-               model->set_assert();
-               model->switch_to_master(NULL);
-       }
+       if (checkDataRaces())
+               model->assert_bug("Data race", true);
 }
 
 /** This function goes through the list of unrealized data races,
@@ -138,7 +136,7 @@ bool checkDataRaces() {
 
 void printRace(struct DataRace *race)
 {
-       printf("Datarace detected @ address %p:\n", race->address);
+       printf("Data race detected @ address %p:\n", race->address);
        printf("    Access 1: %5s in thread %2d @ clock %3u\n",
                        race->isoldwrite ? "write" : "read",
                        id_to_int(race->oldthread), race->oldclock);
@@ -226,7 +224,7 @@ void raceCheckWrite(thread_id_t thread, void *location, ClockVector *currClock)
 }
 
 /** This function does race detection on a read for an expanded record. */
-void fullRaceCheckRead(thread_id_t thread, void *location, uint64_t * shadow, ClockVector *currClock) {
+void fullRaceCheckRead(thread_id_t thread, const void *location, uint64_t * shadow, ClockVector *currClock) {
        struct RaceRecord * record=(struct RaceRecord *) (*shadow);
 
        /* Check for datarace against last write. */
@@ -284,7 +282,7 @@ void fullRaceCheckRead(thread_id_t thread, void *location, uint64_t * shadow, Cl
 }
 
 /** This function does race detection on a read. */
-void raceCheckRead(thread_id_t thread, void *location, ClockVector *currClock) {
+void raceCheckRead(thread_id_t thread, const void *location, ClockVector *currClock) {
        uint64_t * shadow=lookupAddressEntry(location);
        uint64_t shadowval=*shadow;