From: bdemsky Date: Tue, 23 Jun 2009 03:44:27 +0000 (+0000) Subject: changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8fc890f83225a99a53cbaa40094c0ee1268b0780;p=IRC.git changes --- diff --git a/Robust/src/Runtime/STM/delaycomp.h b/Robust/src/Runtime/STM/delaycomp.h new file mode 100644 index 00000000..5fd8bfc5 --- /dev/null +++ b/Robust/src/Runtime/STM/delaycomp.h @@ -0,0 +1,79 @@ +#ifndef DELAYCOMP_H +#define DELAYCOMP_H + +//There is probably a better way for these...but we'll just hardcode +//them for now..probably a real implementation would page protect the +//page after...then default to something simpler + +#define MAXPOINTERS 1024*1024*16 +#define MAXVALUES 1024*1024*16 + +struct pointerlist { + int count; + void * prev; + void * array[MAXPOINTERS]; +}; + +struct primitivelist { + int count; + int array[MAXVALUES]; +}; + +extern __thread pointerlist ptrstack; +extern __thread primitivelist primstack; + +//Pointers + +#define RESTOREPTR(x) x=ptrstack.array[--ptrstack.count] + +#define STOREPTR(x) ptrstack.array[ptrstack.count++]=x + +//Branches + +#define RESTOREANDBRANCH(loc) if (primstack.array[--primstack.count]) goto loc + +#define STOREANDBRANCH(cond, loc) if (primatack.array[primstack.count++]=cond) goto loc + +//Integers + +#define RESTOREI(x) x=primstack.array[--primstack.count] + +#define STOREI(x) primstack.array[primstack.count++]=x + +//Floats + +#define RESTOREF(x) x=*((float *)&primstack.array[--primstack.count]) + +#define STOREF(x) *((float *)&primstack.array[primstack.count++])=x + +//Doubles + +#define RESTORED(x) x=*((double *)&primstack.array[primstack.count-=2]) + +#define STORED(x) *((double *)&primstack.array[primstack.count])=x; primstack.count+=2 + +//Bytes + +#define RESTOREB(x) x=*((char *)&primstack.array[--primstack.count]) + +#define STOREB(x) *((char *)&primstack.array[primstack.count++])=x + +//Characters + +#define RESTOREC(x) x=*((short *)&primstack.array[--primstack.count]) + +#define STOREC(x) *((short *)&primstack.array[primstack.count++])=x + +//Doubles + +#define RESTOREJ(x) x=*((long long *)&primstack.array[primstack.count-=2]) + +#define STOREJ(x) *((long long *)&primstack.array[primstack.count])=x; primstack.count+=2 + +//Booleans + +#define RESTOREZ(x) x=primstack.array[--primstack.count] + +#define STOREZ(x) primstack.array[primstack.count++]=x + +#endif