Vector<TempDescriptor> invars=fsen.getInVarsForDynamicCoarseConflictResolution();
for(int i=0;i<invars.size();i++) {
TempDescriptor tmp=invars.get(i);
- cFile.println(" " + this.getTraverserInvocation(tmp, "rec->"+tmp, fsen));
+ cFile.println(" " + this.getTraverserInvocation(tmp, "rec->"+tmp+", record", fsen));
}
cFile.println( " }");
cFile.println( " break;");
//This will print the traverser invocation that takes in a traverserID and
//starting ptr
private void printResumeTraverserInvocation() {
- headerFile.println("\nint traverse(void * startingPtr, int traverserID);");
- cFile.println("\nint traverse(void * startingPtr, int traverserID) {");
+ headerFile.println("\nint traverse(void * startingPtr, SESEcommon * record, int traverserID);");
+ cFile.println("\nint traverse(void * startingPtr, SESEcommon *record, int traverserID) {");
cFile.println(" switch(traverserID) {");
for(Taint t: doneTaints.keySet()) {
cFile.println(" case " + doneTaints.get(t)+ ":");
if(t.isRBlockTaint()) {
- cFile.println(" " + this.getTraverserInvocation(t.getVar(), "startingPtr", t.getSESE()));
+ cFile.println(" " + this.getTraverserInvocation(t.getVar(), "startingPtr, record", t.getSESE()));
} else if (t.isStallSiteTaint()){
- cFile.println(" " + this.getTraverserInvocation(t.getVar(), "startingPtr", t.getStallSite()));
+ cFile.println(" " + this.getTraverserInvocation(t.getVar(), "startingPtr, record", t.getStallSite()));
} else {
System.out.println("RuntimeConflictResolver encountered a taint that is neither SESE nor stallsite: " + t);
}
}
//IMPORTANT: remember to change getTraverserInvocation if you change the line below
String methodName = "void traverse___" + removeInvalidChars(inVar) +
- removeInvalidChars(rBlock) + "___(void * InVar)";
+ removeInvalidChars(rBlock) + "___(void * InVar, SESEcommon *record)";
cFile.println(methodName + " {");
headerFile.println(methodName + ";");
cFile.println(clearQueue + ";\n" + resetVisitedHashTable + ";");
//Casts the ptr to a genericObjectStruct so we can get to the ptr->allocsite field.
- cFile.println("struct genericObjectStruct * ptr = (struct genericObjectStruct *) InVar;\nif (InVar != NULL) {\n " + queryVistedHashtable
+ cFile.println("struct ___Object___ * ptr = (struct ___Object___ *) InVar;\nif (InVar != NULL) {\n " + queryVistedHashtable
+ "(ptr);\n do {");
cFile.println(" switch(ptr->allocsite) {");
assert heaprootNum != -1;
int allocSiteID = connectedHRHash.get(taint).getWaitingQueueBucketNum(node);
int traverserID = doneTaints.get(taint);
- currCase.append(" rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+","+traverserID+",NULL,NULL)");
+ currCase.append(" rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", record, -1"+")");
} 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(" rcr_READBINCASE(allHashStructures["+heaprootNum+"],"+prefix+","+traverserID+",NULL,NULL)");
+ currCase.append(" rcr_READBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", record, -1"+")");
}
if(objConfRead) {
//#include "WaitingQueue.h"
#include "mlp_lock.h"
#include "mem.h"
+#include "classdefs.h"
//NOTE: this is only temporary (for testing) and will be removed in favor of thread local variables
//It's basically an array of hashStructures so we can simulate what would happen in a many-threaded version
#define ISREADBIN(x) (!(x&BINMASK))
//#define POPCOUNT(x) __builtin_popcountll(x)
//__builtin_popcountll
+#define RESOLVE(x)
+
//NOTE: only temporary
void rcr_createMasterHashTableArray(int maxSize){
if (val==NULL) {
BinItem_rcr * b=(BinItem_rcr*)rcr_createWriteBinItem();
- TraverserData * td = &((WriteBinItem_rcr*)b)->val;
+ WriteBinItem_rcr * td = (WriteBinItem_rcr*)b;
b->total=1;
b->status=READY;
//common to both types
td->task=task;
- td->bitindex=1<<index;
+ td->bitindexrd=td->bitindexwr=1<<index;
be->tail=b;
//release lock
}
BinItem_rcr *bintail=be->tail;
- bitv rdmask=0,wrmask=0;
+ bitvt rdmask=0,wrmask=0;
int status=NOTREADY;
if (ISWRITEBIN(bintail->type)) {
//last one is to check for SESE blocks in a while loop.
if(unlikely(td->task == task)) {
be->head=val;
- bitv bit=1<<index;
+ bitvt bit=1<<index;
if (!(bit & td->bitindexwr)) {
td->bitindexwr|=bit;
td->bitindexrd|=bit;
//if it matches, then we remove it and the code below will upgrade it to a write.
((ReadBinItem_rcr *)bintail)->index--;
atomic_dec(&bintail->total);
- rdmask=tr->bitindex;
+ rdmask=td->bitindex;
if (bintail->status!=READY)
wrmask=rdmask;
status=SPECNOTREADY;
b->item.total=1;
b->task=task;
- bitv bit=1<<index;
+ bitvt bit=1<<index;
if (wrmask&bit) {
//count already includes this
status=READY;
if (bintail->status==READY&&bintail->total==0) {
//we may have to set write as ready
while(val->total==0) {
- if (val==b) {
+ if (val==((BinItem_rcr *)b)) {
b->item.status=READY;
be->head=val;
return READY;
//check if already added item or not.
if (ISWRITEBIN(bintail->type)) {
- WriteBinItem_rcr td = (WriteBinItem_rcr *)bintail;
+ WriteBinItem_rcr * td = (WriteBinItem_rcr *)bintail;
if(unlikely(td->task==task)) {
//RELEASE LOCK
- bitv bit=1<<index;
+ bitvt bit=1<<index;
int status=bintail->status;
if (!(td->bitindexrd & bit)) {
td->bitindexrd|=bit;
td->bitindexwr|=bit;
if (status==NOTREADY)
- status=SNOTREADY;
+ status=SPECNOTREADY;
} else
status=READY;
be->head=val;
TraverserData * td = &((ReadBinItem_rcr *)bintail)->array[((ReadBinItem_rcr *)bintail)->index - 1];
if (unlikely(td->task==task)) {
//RELEASE LOCK
- bitv bit=1<<index;
+ bitvt bit=1<<index;
int status=bintail->status;
if (!(td->bitindex & bit)) {
td->bitindex|=bit;
if (status==NOTREADY)
- status=SNOTREADY;
+ status=SPECNOTREADY;
} else
status=READY;
be->head=val;
rb->item.total=1;
rb->item.status=NOTREADY;
- td->binitem = (BinItem_rcr *) rb;
td->task=task;
td->bitindex=1<<index;
T->array[key].head=val;//released lock
}
-RETIREHASHTABLE(HashStructure *T, SESECommon *task, int key) {
- BinElement_rcr * be = &(T->array[key]);
+rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key) {
+ BinElement_rcr * be = &(T->array[key]);
BinItem_rcr *b=be->head;
if(ISREADBIN(READBIN)) {
ReadBinItem_rcr* rptr=(ReadBinItem_rcr*)ptr;
for (i=0;i<rptr->index;i++) {
RESOLVE(rptr->array[i]);
- if (((INTPTR)rptr->array[i]->task)&PARENTBIN) {
+ if (((INTPTR)rptr->array[i].task)&PARENTBIN) {
//parents go immediately
atomic_dec(&rptr->item.total);
}
break;
if(ptr->status==NOTREADY) {
WriteBinItem_rcr* wptr=(WriteBinItem_rcr*)ptr;
- RESOLVE(wptr->val);
+ RESOLVE(wptr);
ptr->status=READY;
if(((INTPTR)wptr->task)&PARENTBIN) {
val=val->next;
//Todo this is a clone of REntry, remove data fields as necessary\r
typedef struct Entry_rcr {\r
SESEcommon * task;\r
- bitv bitindex;\r
+ bitvt bitindex;\r
} TraverserData;\r
\r
typedef struct WriteBinItem_rcr {\r
BinItem_rcr item;\r
SESEcommon * task;\r
- bitv bitindexwr;\r
- bitv bitindexrd;\r
+ bitvt bitindexwr;\r
+ bitvt bitindexrd;\r
} WriteBinItem_rcr;\r
\r
typedef struct ReadBinItem_rcr {\r
//Method signatures are not in their final form since I have still not decided what is the optimum amount of data\r
//to store in each entry.\r
\r
-int rcr_WRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, void *heaproot);\r
-int rcr_READBINCASE(HashStructure *T, void *ptr, SESEcommon * task, void *heaproot);\r
-int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, void *heaproot);\r
-void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, void *heaproot);\r
+int rcr_WRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index);\r
+int rcr_READBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index);\r
+int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index);\r
+void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index);\r
\r
#endif\r