output.println("primitives."+tmp.getSafeSymbol()+"="+tmp.getSafeSymbol()+";");
}
//do call
- output.println("if (transCommit(&"+ar.name+", &primitives, &"+localsprefix+", "+paramsprefix+")) {");
+ output.println("if (transCommit((void (*)(void *, void *, void *))&"+ar.name+", &primitives, &"+localsprefix+", "+paramsprefix+")) {");
} else
output.println("if (transCommit()) {");
/* Transaction aborts if it returns true */
output.println("else {");
for(Iterator<TempDescriptor> tmpit=ar.liveout.iterator();tmpit.hasNext();) {
TempDescriptor tmp=tmpit.next();
- output.println(tmp.getSafeSymbol()+"=primitive."+tmp.getSafeSymbol()+";");
- output.println("}");
+ output.println(tmp.getSafeSymbol()+"=primitives."+tmp.getSafeSymbol()+";");
}
output.println("}");
+ output.println("}");
}
}
int array[MAXVALUES];
};
-extern __thread pointerlist ptrstack;
-extern __thread primitivelist primstack;
+extern __thread struct pointerlist ptrstack;
+extern __thread struct primitivelist primstack;
//Pointers
#define RESTOREPTR(x) x=ptrstack.array[--ptrstack.count]
-#define STOREPTR(x) ptrstack.array[ptrstack.count++]=x; dc_t_chashInsertOnce(x);
+#define STOREPTR(x) ptrstack.array[ptrstack.count++]=x; dc_t_chashInsertOnce(x,x);
//Branches
#define RESTOREANDBRANCH(loc) if (primstack.array[--primstack.count]) goto loc
-#define STOREANDBRANCH(cond, loc) if (primatack.array[primstack.count++]=cond) goto loc
+#define STOREANDBRANCH(cond, loc) if (primstack.array[primstack.count++]=cond) goto loc
//Integers
__thread objstr_t *t_reserve;
__thread struct objlist * newobjs;
+#ifdef DELAYCOMP
+#include "delaycomp.h"
+__thread struct pointerlist ptrstack;
+__thread struct primitivelist primstack;
+#endif
+
#ifdef TRANSSTATS
int numTransCommit = 0;
int numTransAbort = 0;
#define A_memcpy memcpy
#endif
+extern void * curr_heapbase;
+extern void * curr_heapptr;
+extern void * curr_heaptop;
+
#ifdef STMSTATS
/*** Global variables *****/
objlockstate_t *objlockscope;
A_memcpy(objcopy, header, size);
/* Insert into cache's lookup table */
STATUS(objcopy)=0;
+ if (((unsigned int)oid)<((unsigned int ) curr_heapbase)|| ((unsigned int)oid) >((unsigned int) curr_heapptr))
+ printf("ERROR!\n");
t_chashInsert(oid, &objcopy[1]);
return &objcopy[1];
}
oidwrlocked[numoidwrlocked++] = header;
} else {
//maybe we already have lock
+ void * key=dc_curr->key;
chashlistnode_t *node = &c_table[(((unsigned INTPTR)key) & c_mask)>>4];
do {
oidwrlocked[numoidwrlocked++] = header;
} else {
//maybe we already have lock
+ void * key=dc_curr->key;
chashlistnode_t *node = &c_table[(((unsigned INTPTR)key) & c_mask)>>4];
do {
return TRANS_COMMIT;
}
+#if 0
int altalttraverseCache() {
/* Create info to keep track of objects that can be locked */
int numoidrdlocked=0;
}
return TRANS_COMMIT;
}
-
+#endif
/* ==================================
* transAbortProcess
extern __thread cliststruct_t *c_structs;
#ifdef DELAYCOMP
+extern __thread chashlistnode_t *dc_c_table;
+extern __thread chashlistnode_t *dc_c_list;
+extern __thread unsigned int dc_c_size;
+extern __thread unsigned INTPTR dc_c_mask;
+extern __thread unsigned int dc_c_numelements;
+extern __thread unsigned int dc_c_threshold;
+extern __thread double dc_c_loadfactor;
+extern __thread cliststruct_t *dc_c_structs;
+
void dc_t_chashCreate(unsigned int size, double loadfactor);
void dc_t_chashInsertOnce(void * key, void *val);
void * dc_t_chashSearch(void * key);