4 #include "clockvector.h"
10 struct ShadowBaseTable {
11 uint64_t array[65536];
14 #define MASK16BIT 0xffff
16 void initRaceDetector();
17 void raceCheckWrite(thread_id_t thread, void *location, ClockVector *currClock);
18 void raceCheckRead(thread_id_t thread, void *location, ClockVector *currClock);
24 * (1) points to a full record or
26 * (2) encodes the information in a 64 bit word. Encoding is as
27 * follows: lowest bit set to 1, next 8 bits are read thread id, next
28 * 23 bits are read clock vector, next 8 bites are write thread id,
29 * next 23 bits are write clock vector. */
32 modelclock_t *readClock;
36 thread_id_t writeThread;
37 modelclock_t writeClock;
40 #define INITCAPACITY 4
42 #define ISSHORTRECORD(x) ((x)&0x1)
44 #define THREADMASK 0xff
45 #define RDTHREADID(x) (((x)>>1)&THREADMASK)
46 #define READMASK 0x07fffff
47 #define READVECTOR(x) (((x)>>9)&READMASK)
49 #define WRTHREADID(x) (((x)>>32)&THREADMASK)
51 #define WRITEMASK READMASK
52 #define WRITEVECTOR(x) (((x)>>40)&WRITEMASK)
54 #define ENCODEOP(rdthread, rdtime, wrthread, wrtime) (0x1ULL | ((rdthread)<<1) | ((rdtime) << 9) | (((uint64_t)wrthread)<<32) | (((uint64_t)wrtime)<<40))
56 #define MAXTHREADID (THREADMASK-1)
57 #define MAXREADVECTOR (READMASK-1)
58 #define MAXWRITEVECTOR (WRITEMASK-1)