From: bdemsky Date: Sat, 23 Oct 2010 01:39:33 +0000 (+0000) Subject: changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=70b8cea682158f2e258fbc4aa4f0ac3fe5f87f0e;p=IRC.git changes --- diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index f852c54d..23a21d43 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -694,7 +694,6 @@ public class RuntimeConflictResolver { cFile.println(" int totalcount=RUNBIAS;\n"); if (taint.isStallSiteTaint()) { cFile.println(" record->rcrRecords[0].count=RUNBIAS;\n"); - cFile.println(" record->rcrRecords[0].index=0;\n"); } else { cFile.println(" record->rcrRecords["+index+"].count=RUNBIAS;\n"); cFile.println(" record->rcrRecords["+index+"].index=0;\n"); @@ -795,26 +794,41 @@ public class RuntimeConflictResolver { assert heaprootNum != -1; int allocSiteID = connectedHRHash.get(taint).getWaitingQueueBucketNum(node); int traverserID = doneTaints.get(taint); + currCase.append(" int tmpkey"+depth+"=rcr_generateKey("+prefix+");\n"); if (objConfRead) - currCase.append(" int tmpvar"+depth+"=rcr_WTWRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n"); + currCase.append(" int tmpvar"+depth+"=rcr_WTWRITEBINCASE(allHashStructures["+heaprootNum+"], tmpkey"+depth+", (SESEcommon *) record, "+index+");\n"); else - currCase.append(" int tmpvar"+depth+"=rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n"); + currCase.append(" int tmpvar"+depth+"=rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"], tmpkey"+depth+", (SESEcommon *) record, "+index+");\n"); } else if (primConfRead||objConfRead) { int heaprootNum = connectedHRHash.get(taint).id; assert heaprootNum != -1; int allocSiteID = connectedHRHash.get(taint).getWaitingQueueBucketNum(node); int traverserID = doneTaints.get(taint); + currCase.append(" int tmpkey"+depth+"=rcr_generateKey("+prefix+");\n"); if (objConfRead) - currCase.append(" int tmpvar"+depth+"=rcr_WTREADBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n"); + currCase.append(" int tmpvar"+depth+"=rcr_WTREADBINCASE(allHashStructures["+heaprootNum+"], tmpkey"+depth+", (SESEcommon *) record, "+index+");\n"); else - currCase.append(" int tmpvar"+depth+"=rcr_READBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n"); + currCase.append(" int tmpvar"+depth+"=rcr_READBINCASE(allHashStructures["+heaprootNum+"], tmpkey"+depth+", (SESEcommon *) record, "+index+");\n"); } if(primConfWrite||objConfWrite||primConfRead||objConfRead) { currCase.append("if (!(tmpvar"+depth+"&READYMASK)) totalcount--;\n"); currCase.append("if (!(tmpvar"+depth+"&SPEC)) {\n"); - currCase.append(" struct rcrRecord * rcrrec=&record->rcrRecords["+index+"];"); - currCase.append(" rcrrec->array[rcrrec->index++];"); + if (taint.isStallSiteTaint()) { + currCase.append(" struct rcrRecord * rcrrec=&record->rcrRecords["+index+"];\n"); + currCase.append(" struct rcrRecord * tmprec;\n"); + currCase.append(" if(likely(rcrrec->indexarray[rcrrec->index++]=tmpkey"+depth+";\n"); + currCase.append("} else if(likely((tmprec=rcrrec->next)!=NULL)&&likely(tmprec->indexarray[tmprec->index++]=tmpkey"+depth+";\n"); + currCase.append("} else {\n"); + currCase.append(" struct rcrRecord *trec=RUNMALLOC(sizeof(struct rcrRecord));"); + currCase.append(" trec->array[0]=tmpkey"+depth+";\n"); + currCase.append(" trec->size=1;\n"); + currCase.append(" trec->next=tmprec;\n"); + currCase.append(" rcrrec->next=trec;\n"); + currCase.append("}\n"); + } currCase.append("}\n"); } diff --git a/Robust/src/Runtime/oooJava/hashStructure.c b/Robust/src/Runtime/oooJava/hashStructure.c index 8142cf1c..55d6af0d 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.c +++ b/Robust/src/Runtime/oooJava/hashStructure.c @@ -46,11 +46,10 @@ inline int rcr_generateKey(void * ptr){ return (((struct ___Object___ *) ptr)->oid)&RH_MASK; } -inline int rcr_BWRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index, int mode) { +inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, int index, int mode) { //chain of bins exists => tail is valid //if there is something in front of us, then we are not ready BinItem_rcr * val; - int key=rcr_generateKey(ptr); BinElement_rcr* be= &(T->array[key]); //do not grab head from here since it's locked (i.e. = 0x1) //LOCK is still needed as different threads will remove items... @@ -157,9 +156,8 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int } } -inline int rcr_BREADBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index, int mode) { +inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, int index, int mode) { BinItem_rcr * val; - int key=rcr_generateKey(ptr); BinElement_rcr * be = &(T->array[key]); //LOCK is still needed as different threads will remove items... @@ -236,7 +234,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int i } if (ISREADBIN(bintail->type)) { - int stat=rcr_TAILREADCASE(T, ptr, val, bintail, key, task, index); + int stat=rcr_TAILREADCASE(T, val, bintail, key, task, index); if (mode) { struct BinItem_rcr * bt=be->tail; while(bt->status!=READY) { @@ -247,7 +245,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int i return stat; } } else { - rcr_TAILWRITECASE(T, ptr, val, bintail, key, task, index); + rcr_TAILWRITECASE(T, val, bintail, key, task, index); if (mode) { struct BinItem_rcr * bt=be->tail; while(bt->status!=READY) { @@ -261,22 +259,22 @@ inline int rcr_BREADBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int i } -int rcr_WRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index) { - return rcr_BWRITEBINCASE(T, ptr, task, index, 0); +int rcr_WRITEBINCASE(HashStructure *T, int key, SESEcommon *task, int index) { + return rcr_BWRITEBINCASE(T, key, task, index, 0); } -int rcr_READBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index) { - return rcr_BREADBINCASE(T, ptr, task, index, 0); +int rcr_READBINCASE(HashStructure *T, int key, SESEcommon * task, int index) { + return rcr_BREADBINCASE(T, key, task, index, 0); } -int rcr_WTWRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index) { - return rcr_BWRITEBINCASE(T, ptr, task, index, 1); +int rcr_WTWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, int index) { + return rcr_BWRITEBINCASE(T, key, task, index, 1); } -int rcr_WTREADBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index) { - return rcr_BREADBINCASE(T, ptr, task, index, 1); +int rcr_WTREADBINCASE(HashStructure *T, int key, SESEcommon * task, int index) { + return rcr_BREADBINCASE(T, key, task, index, 1); } -int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index) { +int rcr_TAILREADCASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index) { ReadBinItem_rcr * readbintail=(ReadBinItem_rcr*)T->array[key].tail; int status, retval; TraverserData *td; @@ -308,7 +306,7 @@ int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr return retval; } -void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index) { +void rcr_TAILWRITECASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index) { ReadBinItem_rcr* rb=rcr_createReadBinItem(); TraverserData * td = &(rb->array[rb->index++]); rb->item.total=1; diff --git a/Robust/src/Runtime/oooJava/hashStructure.h b/Robust/src/Runtime/oooJava/hashStructure.h index 9dcee308..e4136a68 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.h +++ b/Robust/src/Runtime/oooJava/hashStructure.h @@ -84,12 +84,12 @@ inline int rcr_generateKey(void * ptr); //to store in each entry. void RESOLVE(SESEcommon *record, bitvt mask); -int rcr_WRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index); -int rcr_READBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index); +int rcr_WRITEBINCASE(HashStructure *T, int key, SESEcommon *task, int index); +int rcr_READBINCASE(HashStructure *T, int key, SESEcommon * task, int index); -int rcr_WTWRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index); -int rcr_WTREADBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index); -int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index); -void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index); +int rcr_WTWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, int index); +int rcr_WTREADBINCASE(HashStructure *T, int key, SESEcommon * task, int index); +int rcr_TAILREADCASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index); +void rcr_TAILWRITECASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index); #endif diff --git a/Robust/src/Runtime/workschedule.c b/Robust/src/Runtime/workschedule.c index 3119b66c..1ce7e925 100644 --- a/Robust/src/Runtime/workschedule.c +++ b/Robust/src/Runtime/workschedule.c @@ -107,6 +107,11 @@ void* workerMain( void* arg ) { stallrecord.common.classID=-1; stallrecord.common.rcrstatus=0; + //initialize rcrRecord + stallrecord.rcrRecords[0].next=NULL; + stallrecord.rcrRecords[0].index=0; + stallrecord.rcrRecords[0].count=0; + if( TRqueue == NULL ) { TRqueue = allocTR(); }