From d2c90c03b2bb8de9ba744ceb1b897a4050f16e73 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 10 Apr 2009 06:29:30 +0000 Subject: [PATCH] 64 bit support in case we want it...it appears that 64 bit binares are slower --- .../Prefetch/ManualPrefetch/Moldyn/makefile | 2 +- .../Benchmarks/SingleTM/LeeRouting/makefile | 2 +- .../Benchmarks/SingleTM/RainForest/makefile | 2 +- Robust/src/IR/Flat/BuildCode.java | 54 ++++++++++++------- Robust/src/Runtime/STM/stm.c | 22 +++----- Robust/src/Runtime/STM/stmlookup.c | 34 ++++++------ Robust/src/Runtime/STM/stmlookup.h | 27 ++++++---- Robust/src/Runtime/STM/tm.h | 31 +++++------ Robust/src/Runtime/garbage.c | 24 ++++----- Robust/src/Runtime/garbage.h | 2 +- Robust/src/Runtime/object.c | 2 +- Robust/src/Runtime/runtime.c | 2 +- Robust/src/Runtime/runtime.h | 8 +++ Robust/src/Runtime/socket.c | 2 +- Robust/src/Runtime/thread.c | 2 +- Robust/src/buildscript | 4 ++ 16 files changed, 119 insertions(+), 101 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/Moldyn/makefile b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/Moldyn/makefile index 1641d7ce..0a6c03c8 100644 --- a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/Moldyn/makefile +++ b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/Moldyn/makefile @@ -1,4 +1,4 @@ -MAINCLASS=JGFMolDynBenchSizeC +MAINCLASS=JGFMolDynBenchSizeB SRC=${MAINCLASS}.java \ JGFInstrumentor.java \ JGFTimer.java \ diff --git a/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile b/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile index 84b07394..a888e0ba 100644 --- a/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile +++ b/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile @@ -5,7 +5,7 @@ SRC=${MAINCLASS}.java \ GridCell.java \ LeeThread.java \ WorkQueue.java -FLAGS=-singleTM -nooptimize -profile -mainclass ${MAINCLASS} -joptimize -debug -garbagestats -transstats +FLAGS=-singleTM -optimize -mainclass ${MAINCLASS} -joptimize -debug -garbagestats -transstats default: ../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} diff --git a/Robust/src/Benchmarks/SingleTM/RainForest/makefile b/Robust/src/Benchmarks/SingleTM/RainForest/makefile index a8760f25..80c11f9c 100644 --- a/Robust/src/Benchmarks/SingleTM/RainForest/makefile +++ b/Robust/src/Benchmarks/SingleTM/RainForest/makefile @@ -10,7 +10,7 @@ SRC=tmp${MAINCLASS}.java \ Node.java \ AStarPathFinder.java -FLAGS=-singleTM -optimize -mainclass ${MAINCLASS} -debug -transstats -joptimize +FLAGS=-singleTM -optimize -mainclass ${MAINCLASS} -debug -transstats -joptimize -profile default: cpp ${MAINCLASS}.java > tmp1${MAINCLASS}.java diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 0cc7d088..d2090b4c 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -426,6 +426,13 @@ public class BuildCode { outstructs.println("#ifndef STRUCTDEFS_H"); outstructs.println("#define STRUCTDEFS_H"); outstructs.println("#include \"classdefs.h\""); + outstructs.println("#ifndef INTPTR"); + outstructs.println("#ifdef BIT64"); + outstructs.println("#define INTPTR long"); + outstructs.println("#else"); + outstructs.println("#define INTPTR int"); + outstructs.println("#endif"); + outstructs.println("#endif"); /* Output #defines that the runtime uses to determine type * numbers for various objects it needs */ @@ -468,6 +475,13 @@ public class BuildCode { protected void outputClassDeclarations(PrintWriter outclassdefs) { if (state.THREAD||state.DSM||state.SINGLETM) outclassdefs.println("#include "); + outclassdefs.println("#ifndef INTPTR"); + outclassdefs.println("#ifdef BIT64"); + outclassdefs.println("#define INTPTR long"); + outclassdefs.println("#else"); + outclassdefs.println("#define INTPTR int"); + outclassdefs.println("#endif"); + outclassdefs.println("#endif"); if(state.OPTIONAL) outclassdefs.println("#include \"optionalstruct.h\""); outclassdefs.println("struct "+arraytype+";"); @@ -508,7 +522,7 @@ public class BuildCode { outclassdefs.println("};\n"); outclassdefs.println("extern int classsize[];"); outclassdefs.println("extern int hasflags[];"); - outclassdefs.println("extern unsigned int * pointerarray[];"); + outclassdefs.println("extern unsigned INTPTR * pointerarray[];"); outclassdefs.println("extern int supertypes[];"); } @@ -1013,7 +1027,7 @@ public class BuildCode { Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); while(it.hasNext()) { ClassDescriptor cn=(ClassDescriptor)it.next(); - output.println("unsigned int "+cn.getSafeSymbol()+"_pointers[]={"); + output.println("unsigned INTPTR "+cn.getSafeSymbol()+"_pointers[]={"); Iterator allit=cn.getFieldTable().getAllDescriptorsIterator(); int count=0; while(allit.hasNext()) { @@ -1033,12 +1047,12 @@ public class BuildCode { continue; if (type.isPtr()) { output.println(","); - output.print("((unsigned int)&(((struct "+cn.getSafeSymbol() +" *)0)->"+fd.getSafeSymbol()+"))"); + output.print("((unsigned INTPTR)&(((struct "+cn.getSafeSymbol() +" *)0)->"+fd.getSafeSymbol()+"))"); } } output.println("};"); } - output.println("unsigned int * pointerarray[]={"); + output.println("unsigned INTPTR * pointerarray[]={"); boolean needcomma=false; for(int i=0; i"+ fd.getSafeSymbol()+");"); + output.println(generateTemp(fm, fofn.getDst(),lb)+ " = (short)(int) (&((struct "+fofn.getClassType().getSafeSymbol() +" *)0)->"+ fd.getSafeSymbol()+");"); output.println("/* offset */"); } @@ -2240,12 +2254,12 @@ public class BuildCode { String dst=generateTemp(fm,fsfn.getDst(),lb); if (srcptr&&!fsfn.getSrc().getType().isNull()) { output.println("{"); - output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);"); + output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);"); } if (wb.needBarrier(fsfn)) output.println("*((unsigned int *)&("+dst+"->___objstatus___))|=DIRTY;"); if (srcptr&!fsfn.getSrc().getType().isNull()) { - output.println("*((unsigned int *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); + output.println("*((unsigned INTPTR *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); output.println("}"); } else { output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); @@ -2259,7 +2273,7 @@ public class BuildCode { String dst=generateTemp(fm,fsfn.getDst(),lb); if (srcglobal) { output.println("{"); - output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);"); + output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);"); } if (statusdst.equals(LocalityAnalysis.GLOBAL)) { String glbdst=dst; @@ -2267,7 +2281,7 @@ public class BuildCode { if (wb.needBarrier(fsfn)) output.println("*((unsigned int *)&("+dst+"->___localcopy___))|=DIRTY;"); if (srcglobal) { - output.println("*((unsigned int *)&("+glbdst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); + output.println("*((unsigned INTPTR *)&("+glbdst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); } else output.println(glbdst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); } else if (statusdst.equals(LocalityAnalysis.LOCAL)) { @@ -2284,7 +2298,7 @@ public class BuildCode { output.println("revertlist=(struct ___Object___ *)"+dst+";"); output.println("}"); if (srcglobal) - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=srcoid;"); + output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=(void *) srcoid;"); else output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); } else if (statusdst.equals(LocalityAnalysis.EITHER)) { @@ -2292,7 +2306,7 @@ public class BuildCode { output.println("if ("+dst+") {"); output.println("printf(\"BIG ERROR 2\\n\");exit(-1);}"); if (srcglobal) - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=srcoid;"); + output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=(void *) srcoid;"); else output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); } @@ -2389,8 +2403,8 @@ public class BuildCode { if (fsen.getSrc().getType().isPtr()&&!fsen.getSrc().getType().isNull()) { output.println("{"); String src=generateTemp(fm, fsen.getSrc(), lb); - output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);"); - output.println("((int*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;"); + output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);"); + output.println("((INTPTR*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;"); output.println("}"); } else { output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";"); @@ -2423,8 +2437,8 @@ public class BuildCode { if (srcglobal) { output.println("{"); String src=generateTemp(fm, fsen.getSrc(), lb); - output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);"); - output.println("((int*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;"); + output.println("INTPTR srcoid=("+src+"!=NULL?((INTPTR)"+src+"->"+oidstr+"):0);"); + output.println("((INTPTR*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;"); output.println("}"); } else { output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";"); diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 6cf89a74..5e45a495 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -152,7 +152,6 @@ void *objstrAlloc(objstr_t **osptr, unsigned int size) { * ============================================================= */ __attribute__((pure)) void *transRead(void * oid) { - unsigned int machinenumber; objheader_t *tmp, *objheader; objheader_t *objcopy; int size; @@ -170,7 +169,7 @@ __attribute__((pure)) void *transRead(void * oid) { memcpy(objcopy, header, size); /* Insert into cache's lookup table */ STATUS(objcopy)=0; - t_chashInsert((unsigned int)oid, &objcopy[1]); + t_chashInsert(oid, &objcopy[1]); return &objcopy[1]; } @@ -249,8 +248,8 @@ int traverseCache() { /* Create info to keep track of objects that can be locked */ int numoidrdlocked=0; int numoidwrlocked=0; - unsigned int oidrdlocked[c_numelements]; - unsigned int oidwrlocked[c_numelements]; + void * oidrdlocked[c_numelements]; + void * oidwrlocked[c_numelements]; int softabort=0; int i; chashlistnode_t *ptr = c_table; @@ -261,7 +260,7 @@ int traverseCache() { /* Inner loop to traverse the linked list of the cache lookupTable */ while(curr != NULL) { //if the first bin in hash table is empty - if(curr->key == 0) + if(curr->key == NULL) break; objheader_t * headeraddr=&((objheader_t *) curr->val)[-1]; @@ -321,20 +320,13 @@ int traverseCache() { } } -/* =========================================================================== - * decideResponse - * - increments counters that keep track of objects read, modified or locked - * - updates the oids locked and oids newly created - * =========================================================================== - */ - /* ================================== * transAbortProcess * * ================================= */ -int transAbortProcess(unsigned int *oidrdlocked, int *numoidrdlocked, unsigned int *oidwrlocked, int *numoidwrlocked) { +int transAbortProcess(void **oidrdlocked, int *numoidrdlocked, void **oidwrlocked, int *numoidwrlocked) { int i; objheader_t *header; /* Release read locks */ @@ -357,8 +349,8 @@ int transAbortProcess(unsigned int *oidrdlocked, int *numoidrdlocked, unsigned i * * ================================= */ -int transCommitProcess(unsigned int *oidrdlocked, int *numoidrdlocked, - unsigned int *oidwrlocked, int *numoidwrlocked) { +int transCommitProcess(void ** oidrdlocked, int *numoidrdlocked, + void ** oidwrlocked, int *numoidwrlocked) { objheader_t *header; void *ptrcreate; int i; diff --git a/Robust/src/Runtime/STM/stmlookup.c b/Robust/src/Runtime/STM/stmlookup.c index 1626d271..cc9a77e0 100644 --- a/Robust/src/Runtime/STM/stmlookup.c +++ b/Robust/src/Runtime/STM/stmlookup.c @@ -2,7 +2,7 @@ __thread chashlistnode_t *c_table; __thread unsigned int c_size; -__thread unsigned int c_mask; +__thread unsigned INTPTR c_mask; __thread unsigned int c_numelements; __thread unsigned int c_threshold; __thread double c_loadfactor; @@ -52,12 +52,12 @@ chashtable_t *chashCreate(unsigned int size, double loadfactor) { } //Finds the right bin in the hash table -static INLINE unsigned int chashFunction(chashtable_t *table, unsigned int key) { - return ( key & (table->mask))>>3; //throw away low order bit +static INLINE unsigned int chashFunction(chashtable_t *table, void * key) { + return (((unsigned INTPTR) key) & (table->mask))>>3; //throw away low order bit } //Store objects and their pointers into hash -void chashInsert(chashtable_t *table, unsigned int key, void *val) { +void chashInsert(chashtable_t *table, void * key, void *val) { chashlistnode_t *ptr; if(table->numelements > (table->threshold)) { @@ -66,7 +66,7 @@ void chashInsert(chashtable_t *table, unsigned int key, void *val) { chashResize(table,newsize); } - ptr = &table->table[(key&table->mask)>>3]; + ptr = &table->table[(((unsigned INTPTR)key)&table->mask)>>3]; table->numelements++; if(ptr->key==0) { @@ -82,9 +82,9 @@ void chashInsert(chashtable_t *table, unsigned int key, void *val) { } // Search for an address for a given oid -INLINE void * chashSearch(chashtable_t *table, unsigned int key) { +INLINE void * chashSearch(chashtable_t *table, void * key) { //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE - chashlistnode_t *node = &table->table[(key & table->mask)>>3]; + chashlistnode_t *node = &table->table[(((unsigned INTPTR)key) & table->mask)>>3]; do { if(node->key == key) { @@ -97,7 +97,7 @@ INLINE void * chashSearch(chashtable_t *table, unsigned int key) { } //Store objects and their pointers into hash -void t_chashInsert(unsigned int key, void *val) { +void t_chashInsert(void * key, void *val) { chashlistnode_t *ptr; @@ -107,7 +107,7 @@ void t_chashInsert(unsigned int key, void *val) { t_chashResize(newsize); } - ptr = &c_table[(key&c_mask)>>3]; + ptr = &c_table[(((unsigned INTPTR)key)&c_mask)>>3]; c_numelements++; if(ptr->key==0) { @@ -123,9 +123,9 @@ void t_chashInsert(unsigned int key, void *val) { } // Search for an address for a given oid -INLINE void * t_chashSearch(unsigned int key) { +INLINE void * t_chashSearch(void * key) { //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE - chashlistnode_t *node = &c_table[(key & c_mask)>>3]; + chashlistnode_t *node = &c_table[(((unsigned INTPTR)key) & c_mask)>>3]; do { if(node->key == key) { @@ -137,12 +137,12 @@ INLINE void * t_chashSearch(unsigned int key) { return NULL; } -unsigned int chashRemove(chashtable_t *table, unsigned int key) { +unsigned int chashRemove(chashtable_t *table, void * key) { return chashRemove2(table, key)==NULL; } -void * chashRemove2(chashtable_t *table, unsigned int key) { +void * chashRemove2(chashtable_t *table, void * key) { int index; chashlistnode_t *curr, *prev; chashlistnode_t *ptr, *node; @@ -202,14 +202,14 @@ unsigned int chashResize(chashtable_t *table, unsigned int newsize) { curr = &ptr[i]; isfirst = 1; do { //Inner loop to go through linked lists - unsigned int key; + void * key; chashlistnode_t *tmp,*next; if ((key=curr->key) == 0) { //Exit inner loop if there the first element is 0 break; //key = val =0 for element if not present within the hash table } next = curr->next; - index = (key & mask) >>3; + index = (((unsigned INTPTR)key) & mask) >>3; tmp=&node[index]; // Insert into the new table if(tmp->key == 0) { @@ -266,14 +266,14 @@ unsigned int t_chashResize(unsigned int newsize) { curr = &ptr[i]; isfirst = 1; do { //Inner loop to go through linked lists - unsigned int key; + void * key; chashlistnode_t *tmp,*next; if ((key=curr->key) == 0) { //Exit inner loop if there the first element is 0 break; //key = val =0 for element if not present within the hash table } next = curr->next; - index = (key & mask) >>3; + index = (((unsigned INTPTR)key) & mask) >>3; tmp=&node[index]; // Insert into the new table if(tmp->key == 0) { diff --git a/Robust/src/Runtime/STM/stmlookup.h b/Robust/src/Runtime/STM/stmlookup.h index 2382208e..7189bcdd 100644 --- a/Robust/src/Runtime/STM/stmlookup.h +++ b/Robust/src/Runtime/STM/stmlookup.h @@ -4,6 +4,14 @@ #include #include +#ifndef INTPTR +#ifdef BIT64 +#define INTPTR long +#else +#define INTPTR int +#endif +#endif + #define CLOADFACTOR 0.25 #define CHASH_SIZE 1024 @@ -11,8 +19,8 @@ typedef struct chashlistnode { - unsigned int key; - void *val; //this can be cast to another type or used to point to a larger structure + void * key; + void * val; //this can be cast to another type or used to point to a larger structure struct chashlistnode *next; } chashlistnode_t; @@ -27,25 +35,24 @@ typedef struct chashtable { void t_chashCreate(unsigned int size, double loadfactor); -void t_chashInsert(unsigned int key, void *val); -void * t_chashSearch(unsigned int key); +void t_chashInsert(void * key, void *val); +void * t_chashSearch(void * key); unsigned int t_chashResize(unsigned int newsize); void t_chashDelete(); /* Prototypes for hash*/ chashtable_t *chashCreate(unsigned int size, double loadfactor); -static unsigned int chashFunction(chashtable_t *table, unsigned int key); -void chashInsert(chashtable_t *table, unsigned int key, void *val); -void *chashSearch(chashtable_t *table, unsigned int key); //returns val, NULL if not found -unsigned int chashRemove(chashtable_t *table, unsigned int key); //returns -1 if not found -void * chashRemove2(chashtable_t *table, unsigned int key); //returns -1 if not found +void chashInsert(chashtable_t *table, void * key, void *val); +void *chashSearch(chashtable_t *table, void * key); //returns val, NULL if not found +unsigned int chashRemove(chashtable_t *table, void * key); //returns -1 if not found +void * chashRemove2(chashtable_t *table, void * key); //returns -1 if not found unsigned int chashResize(chashtable_t *table, unsigned int newsize); void chashDelete(chashtable_t *table); /* end hash */ extern __thread chashlistnode_t *c_table; extern __thread unsigned int c_size; -extern __thread unsigned int c_mask; +extern __thread unsigned INTPTR c_mask; extern __thread unsigned int c_numelements; extern __thread unsigned int c_threshold; extern __thread double c_loadfactor; diff --git a/Robust/src/Runtime/STM/tm.h b/Robust/src/Runtime/STM/tm.h index 8c231135..deee9282 100644 --- a/Robust/src/Runtime/STM/tm.h +++ b/Robust/src/Runtime/STM/tm.h @@ -1,6 +1,6 @@ #ifndef _TM_H_ #define _TM_H_ - +#include "runtime.h" /* ================== * Control Messages * ================== @@ -46,10 +46,10 @@ typedef struct objheader { } objheader_t; #define OID(x) \ - (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objlocation___)) + (*((void **)&((struct ___Object___ *)(((char *) x) + sizeof(objheader_t)))->___objlocation___)) #define COMPOID(x) \ - ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___objlocation___)) : 0)) + ((((void *) x )!=NULL) ? (*((void **)&((struct ___Object___ *) x)->___objlocation___)) : NULL) #define STATUS(x) \ *((unsigned int *) &(((struct ___Object___ *)(((char *) x) + sizeof(objheader_t)))->___objstatus___)) @@ -58,7 +58,7 @@ typedef struct objheader { ((unsigned int *) &(((struct ___Object___ *)(((char *) x) + sizeof(objheader_t)))->___objstatus___)) #define TYPE(x) \ - ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type + ((struct ___Object___ *)((char *) x + sizeof(objheader_t)))->type #define GETSIZE(size, x) { \ int type=TYPE(x); \ @@ -83,17 +83,17 @@ typedef struct objheader { * ================================ */ #define DEFAULT_OBJ_STORE_SIZE 1048510 //1MB -#define OSUSED(x) (((unsigned int)(x)->top)-((unsigned int) (x+1))) +#define OSUSED(x) (((unsigned INTPTR)(x)->top)-((unsigned INTPTR) (x+1))) #define OSFREE(x) ((x)->size-OSUSED(x)) #define TRANSREAD(x,y) { \ - unsigned int inputvalue;\ -if ((inputvalue=(unsigned int)y)==0) x=NULL;\ + void * inputvalue;\ +if ((inputvalue=y)==NULL) x=NULL;\ else { \ -chashlistnode_t * cnodetmp=&c_table[(inputvalue&c_mask)>>3]; \ +chashlistnode_t * cnodetmp=&c_table[(((unsigned INTPTR)inputvalue)&c_mask)>>3]; \ do { \ - if (cnodetmp->key==inputvalue) {x=(void *)cnodetmp->val;break;} \ + if (cnodetmp->key==inputvalue) {x=cnodetmp->val;break;} \ cnodetmp=cnodetmp->next;\ - if (cnodetmp==NULL) {x=transRead((void *)inputvalue); asm volatile("":"=m"(c_table),"=m"(c_mask));break;} \ + if (cnodetmp==NULL) {x=transRead(inputvalue); asm volatile("":"=m"(c_table),"=m"(c_mask));break;} \ } while(1);\ }} @@ -117,12 +117,6 @@ struct objlist { extern __thread struct objlist * newobjs; -typedef struct newObjCreated { - unsigned int numcreated; - unsigned int *oidcreated; -} newObjCreated_t; - - #ifdef TRANSSTATS /*********************************** * Global Variables for statistics @@ -148,9 +142,8 @@ void *objstrAlloc(objstr_t **osptr, unsigned int size); __attribute__((pure)) void *transRead(void * oid); int transCommit(); int traverseCache(); -int decideResponse(objheader_t *, unsigned int *, int *, unsigned int*, int *); -int transAbortProcess(unsigned int *, int *, unsigned int *, int *); -int transCommmitProcess(unsigned int *, int *, unsigned int *, int *); +int transAbortProcess(void **, int *, void **, int *); +int transCommmitProcess(void **, int *, void **, int *); void randomdelay(); #endif diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index bb312b5e..fb6c161f 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -172,12 +172,12 @@ void fixtable(chashlistnode_t ** tc_table, unsigned int tc_size) { //rewrite transaction cache entry void *vptr=curr->val; int type=((int *)vptr)[0]; - unsigned int *pointer=pointerarray[type]; + unsigned INTPTR *pointer=pointerarray[type]; if (pointer==0) { //array of primitives - do nothing struct ArrayObject *ao=(struct ArrayObject *) vptr; SENQUEUE((void *)ao->___objlocation___, *((void **)&ao->___objlocation___)); - } else if (((int)pointer)==1) { + } else if (((INTPTR)pointer)==1) { //array of pointers struct ArrayObject *ao=(struct ArrayObject *) vptr; int length=ao->___length___; @@ -188,20 +188,20 @@ void fixtable(chashlistnode_t ** tc_table, unsigned int tc_size) { SENQUEUE(objptr, ((void **)(((char *)&ao->___length___)+sizeof(int)))[i]); } } else { - int size=pointer[0]; + INTPTR size=pointer[0]; int i; for(i=1; i<=size; i++) { unsigned int offset=pointer[i]; - void * objptr=*((void **)(((int)vptr)+offset)); - SENQUEUE(objptr, *((void **)(((int)vptr)+offset))); + void * objptr=*((void **)(((char *)vptr)+offset)); + SENQUEUE(objptr, *((void **)(((char *)vptr)+offset))); } } } next = curr->next; - index = (((unsigned int)key) & mask) >>3; + index = (((unsigned INTPTR)key) & mask) >>3; - curr->key=(unsigned int)key; + curr->key=key; tmp=&node[index]; // Insert into the new table if(tmp->key == 0) { @@ -428,7 +428,7 @@ void collect(struct garbagelist * stackptr) { void * ptr=dequeue(); void *cpy=((void **)ptr)[1]; int type=((int *)cpy)[0]; - unsigned int * pointer; + unsigned INTPTR * pointer; #ifdef TASK if(type==TAGTYPE) { /* Enqueue Tag */ @@ -452,7 +452,7 @@ void collect(struct garbagelist * stackptr) { struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; SENQUEUE((void *)ao->___objlocation___, *((void **)&ao_cpy->___objlocation___)); #endif - } else if (((int)pointer)==1) { + } else if (((INTPTR)pointer)==1) { /* Array of pointers */ struct ArrayObject *ao=(struct ArrayObject *) ptr; struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; @@ -470,12 +470,12 @@ void collect(struct garbagelist * stackptr) { ENQUEUE(objptr, ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]); } } else { - int size=pointer[0]; + INTPTR size=pointer[0]; int i; for(i=1; i<=size; i++) { unsigned int offset=pointer[i]; - void * objptr=*((void **)(((int)ptr)+offset)); - ENQUEUE(objptr, *((void **)(((int)cpy)+offset))); + void * objptr=*((void **)(((char *)ptr)+offset)); + ENQUEUE(objptr, *((void **)(((char *)cpy)+offset))); } } } diff --git a/Robust/src/Runtime/garbage.h b/Robust/src/Runtime/garbage.h index 35b88621..7a9dc9c7 100644 --- a/Robust/src/Runtime/garbage.h +++ b/Robust/src/Runtime/garbage.h @@ -1,7 +1,7 @@ #ifndef GARBAGE_H #define GARBAGE_H #ifdef STM -#include "clookup.h" +#include "stmlookup.h" #endif struct garbagelist { int size; diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index 32547f61..766d2a64 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -11,7 +11,7 @@ #endif int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) { - return (int) VAR(___this___); + return (int)((INTPTR) VAR(___this___)); } int CALL01(___Object______getType____, struct ___Object___ * ___this___) { diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index cc422786..e0884c42 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -326,7 +326,7 @@ __attribute__((malloc)) struct ___String___ * NewString(const char *str,int leng int i; #ifdef PRECISE_GC struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length); - int ptrarray[]={1, (int) ptr, (int) chararray}; + INTPTR ptrarray[]={1, (INTPTR) ptr, (INTPTR) chararray}; struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE); chararray=(struct ArrayObject *) ptrarray[2]; #else diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 2ca7d2a7..032eb29f 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -8,6 +8,14 @@ extern int failurecount; #include "dstm.h" #endif +#ifndef INTPTR +#ifdef BIT64 +#define INTPTR long +#else +#define INTPTR int +#endif +#endif + extern void * curr_heapbase; extern void * curr_heaptop; diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c index b82840e9..12f5d439 100644 --- a/Robust/src/Runtime/socket.c +++ b/Robust/src/Runtime/socket.c @@ -160,7 +160,7 @@ struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct A struct ArrayObject *bytearray; #ifdef PRECISE_GC { - int ptrarray[]={1, (int) ___params___, (int)arraybytearray}; + INTPTR ptrarray[]={1, (INTPTR) ___params___, (INTPTR)arraybytearray}; bytearray=allocate_newarray(&ptrarray,BYTEARRAYTYPE,h->h_length); arraybytearray=(struct ArrayObject *) ptrarray[2]; } diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c index ca659d9d..9bd7aa0f 100644 --- a/Robust/src/Runtime/thread.c +++ b/Robust/src/Runtime/thread.c @@ -113,7 +113,7 @@ void initializethreads() { #if defined(THREADS)||defined(STM) void initthread(struct ___Thread___ * ___this___) { #ifdef PRECISE_GC - int p[]={1, (int) NULL, (int) ___this___}; + INTPTR p[]={1, (INTPTR) NULL, (INTPTR) ___this___}; #ifdef THREADS ___Thread______staticStart____L___Thread___((struct ___Thread______staticStart____L___Thread____params *)p); #else diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 12279bcb..aed6fc0c 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -10,6 +10,7 @@ echo -dsmcaching -enable caching in dsm runtime echo -mac distributed shared memory mac support echo -check generate check code echo -dmalloc link in dmalloc +echo -64bit compile for 64 bit machine echo -recover compile task code echo -fastcheck fast checkpointing for Bristlecone echo -specdir directory @@ -117,6 +118,9 @@ NOJAVA=true elif [[ $1 = '-garbagestats' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS" +elif [[ $1 = '-64bit' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64" elif [[ $1 = '-fastcheck' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK" -- 2.34.1