From 84124c86b503c83a823b0709149ce451daa22557 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 23 Jun 2009 06:04:09 +0000 Subject: [PATCH] more fixes to get things to compile --- Robust/src/IR/Flat/BuildCode.java | 6 +++--- Robust/src/Runtime/STM/delaycomp.h | 8 ++++---- Robust/src/Runtime/STM/stm.c | 17 ++++++++++++++++- Robust/src/Runtime/STM/stmlookup.h | 9 +++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 22686a7a..0dd776a6 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2504,7 +2504,7 @@ public class BuildCode { 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 */ @@ -2526,10 +2526,10 @@ public class BuildCode { output.println("else {"); for(Iterator 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("}"); } } diff --git a/Robust/src/Runtime/STM/delaycomp.h b/Robust/src/Runtime/STM/delaycomp.h index 4676e852..1f87c795 100644 --- a/Robust/src/Runtime/STM/delaycomp.h +++ b/Robust/src/Runtime/STM/delaycomp.h @@ -19,20 +19,20 @@ struct primitivelist { 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 diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 6fec140c..61a2354e 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -18,6 +18,12 @@ __thread objstr_t *t_cache; __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; @@ -56,6 +62,10 @@ void * A_memcpy (void * dest, const void * src, size_t count); #define A_memcpy memcpy #endif +extern void * curr_heapbase; +extern void * curr_heapptr; +extern void * curr_heaptop; + #ifdef STMSTATS /*** Global variables *****/ objlockstate_t *objlockscope; @@ -256,6 +266,8 @@ __attribute__((pure)) void *transRead(void * oid, void *gl) { 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]; } @@ -513,6 +525,7 @@ int traverseCache() { 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 { @@ -719,6 +732,7 @@ int alttraverseCache() { 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 { @@ -803,6 +817,7 @@ int alttraverseCache() { return TRANS_COMMIT; } +#if 0 int altalttraverseCache() { /* Create info to keep track of objects that can be locked */ int numoidrdlocked=0; @@ -958,7 +973,7 @@ int altalttraverseCache() { } return TRANS_COMMIT; } - +#endif /* ================================== * transAbortProcess diff --git a/Robust/src/Runtime/STM/stmlookup.h b/Robust/src/Runtime/STM/stmlookup.h index bdfe70f5..cecb8051 100644 --- a/Robust/src/Runtime/STM/stmlookup.h +++ b/Robust/src/Runtime/STM/stmlookup.h @@ -60,6 +60,15 @@ extern __thread double c_loadfactor; 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); -- 2.34.1