Try to catch data races for memcpy
[c11tester.git] / datarace.cc
index da5fa8ce6ea6434ebacf0201e36f44cbba376d7b..13aa4655ce05bf254d66604b3f359622a5c00941 100644 (file)
@@ -55,7 +55,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(const void *address)
+static inline uint64_t * lookupAddressEntry(const void *address)
 {
        struct ShadowTable *currtable = root;
 #if BIT48
@@ -500,7 +500,7 @@ void recordWrite(thread_id_t thread, void *location) {
 
 /** This function just updates metadata on atomic write. */
 void recordCalloc(void *location, size_t size) {
-       thread_id_t thread = thread_current()->get_id();
+       thread_id_t thread = thread_current_id();
        for(;size != 0;size--) {
                uint64_t *shadow = lookupAddressEntry(location);
                uint64_t shadowval = *shadow;
@@ -575,8 +575,8 @@ struct DataRace * fullRaceCheckRead(thread_id_t thread, const void *location, ui
                        int newCapacity = copytoindex * 2;
                        thread_id_t *newthread = (thread_id_t *)snapshot_malloc(sizeof(thread_id_t) * newCapacity);
                        modelclock_t *newreadClock = (modelclock_t *)snapshot_malloc(sizeof(modelclock_t) * newCapacity);
-                       std::memcpy(newthread, record->thread, copytoindex * sizeof(thread_id_t));
-                       std::memcpy(newreadClock, record->readClock, copytoindex * sizeof(modelclock_t));
+                       real_memcpy(newthread, record->thread, copytoindex * sizeof(thread_id_t));
+                       real_memcpy(newreadClock, record->readClock, copytoindex * sizeof(modelclock_t));
                        snapshot_free(record->readClock);
                        snapshot_free(record->thread);
                        record->readClock = newreadClock;