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");
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->index<RCRSIZE)) {\n");
+ currCase.append(" rcrrec->array[rcrrec->index++]=tmpkey"+depth+";\n");
+ currCase.append("} else if(likely((tmprec=rcrrec->next)!=NULL)&&likely(tmprec->index<RCRSIZE)) {\n");
+ currCase.append(" tmprec->array[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");
}
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...
}
}
-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...
}
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) {
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) {
}
-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;
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;
//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