}
*shadow = ENCODEOP(threadid, ourClock, id_to_int(writeThread), writeClock) | (shadowval & ATOMICMASK);
+
+ *old_val = shadowval;
+ *new_val = *shadow;
}
Exit:
if (race) {
assert_race(race);
else model_free(race);
}
-
-
- *old_val = shadowval;
- *new_val = *shadow;
}
static inline void raceCheckRead_otherIt(thread_id_t thread, const void * location, uint64_t first_shadowval, uint64_t updated_shadowval)
uint64_t *shadow = lookupAddressEntry(location);
uint64_t shadowval = *shadow;
- if (shadowval != 0 && shadowval == first_shadowval) {
+ if (shadowval == first_shadowval) {
*shadow = updated_shadowval;
return;
}
void raceCheckRead64(thread_id_t thread, const void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckRead_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckRead_otherIt(thread, (const void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckRead32(thread_id_t thread, const void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckRead_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckRead_otherIt(thread, (const void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckRead16(thread_id_t thread, const void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckRead_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckRead_otherIt(thread, (const void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckRead8(thread_id_t thread, const void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckRead_firstIt(thread, location, &old_shadowval, &new_shadowval);
}
ShadowExit:
*shadow = ENCODEOP(0, 0, threadid, ourClock);
+
+ *old_val = shadowval;
+ *new_val = *shadow;
}
Exit:
assert_race(race);
else model_free(race);
}
-
- *old_val = shadowval;
- *new_val = *shadow;
}
static inline void raceCheckWrite_otherIt(thread_id_t thread, void * location, uint64_t first_shadowval, uint64_t updated_shadowval)
uint64_t *shadow = lookupAddressEntry(location);
uint64_t shadowval = *shadow;
- if (shadowval != 0 && shadowval == first_shadowval) {
+ if (shadowval == first_shadowval) {
*shadow = updated_shadowval;
return;
}
void raceCheckWrite64(thread_id_t thread, void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckWrite_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckWrite_otherIt(thread, (void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckWrite32(thread_id_t thread, void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckWrite_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckWrite_otherIt(thread, (void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckWrite16(thread_id_t thread, void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckWrite_firstIt(thread, location, &old_shadowval, &new_shadowval);
raceCheckWrite_otherIt(thread, (void *)(((uintptr_t)location) + 1), old_shadowval, new_shadowval);
void raceCheckWrite8(thread_id_t thread, void *location)
{
uint64_t old_shadowval, new_shadowval;
- old_shadowval = new_shadowval = 0;
+ old_shadowval = new_shadowval = INVALIDSHADOWVAL;
raceCheckWrite_firstIt(thread, location, &old_shadowval, &new_shadowval);
}
return;
thread_id_t tid = thread_current()->get_id();
raceCheckWrite8(tid, addr);
-
-// raceCheckWrite(tid, addr);
}
void cds_store16(void *addr)
return;
thread_id_t tid = thread_current()->get_id();
raceCheckWrite16(tid, addr);
-
-// raceCheckWrite(tid, addr);
-// raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 1));
}
void cds_store32(void *addr)
return;
thread_id_t tid = thread_current()->get_id();
raceCheckWrite32(tid, addr);
-
-/*
- raceCheckWrite(tid, addr);
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 1));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 2));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 3));
-*/
}
void cds_store64(void *addr)
return;
thread_id_t tid = thread_current()->get_id();
raceCheckWrite64(tid, addr);
-
-/*
- raceCheckWrite(tid, addr);
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 1));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 2));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 3));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 4));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 5));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 6));
- raceCheckWrite(tid, (void *)(((uintptr_t)addr) + 7));
-*/
}
void cds_load8(const void *addr) {
if (!model)
return;
thread_id_t tid = thread_current()->get_id();
-
raceCheckRead8(tid, addr);
-
-// raceCheckRead(tid, addr);
}
void cds_load16(const void *addr) {
if (!model)
return;
thread_id_t tid = thread_current()->get_id();
-
raceCheckRead16(tid, addr);
-// raceCheckRead(tid, addr);
-// raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 1));
}
void cds_load32(const void *addr) {
if (!model)
return;
thread_id_t tid = thread_current()->get_id();
-
raceCheckRead32(tid, addr);
-/*
- raceCheckRead(tid, addr);
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 1));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 2));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 3));
-*/
}
void cds_load64(const void *addr) {
if (!model)
return;
thread_id_t tid = thread_current()->get_id();
-
raceCheckRead64(tid, addr);
-/*
- raceCheckRead(tid, addr);
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 1));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 2));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 3));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 4));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 5));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 6));
- raceCheckRead(tid, (const void *)(((uintptr_t)addr) + 7));
-*/
}