changes
authorbdemsky <bdemsky>
Thu, 21 Oct 2010 05:00:18 +0000 (05:00 +0000)
committerbdemsky <bdemsky>
Thu, 21 Oct 2010 05:00:18 +0000 (05:00 +0000)
Robust/src/IR/Flat/RuntimeConflictResolver.java
Robust/src/Runtime/oooJava/hashStructure.c
Robust/src/Runtime/oooJava/hashStructure.h

index cc839f2f93b7049043816edf2e668a20a4023d80..aa8334f0cc072f5dc6ef6f2f35f46f6395855b80 100644 (file)
@@ -674,6 +674,7 @@ public class RuntimeConflictResolver {
       //need to add this
     } else {
       cFile.println("    record->rcrRecords["+index+"].count=RUNBIAS;\n");
+      cFile.println("    record->rcrRecords["+index+"].index=0;\n");
     }
     
     if(cSideDebug) {
@@ -701,7 +702,7 @@ public class RuntimeConflictResolver {
       //need to add this
     } else {
       cFile.println("     if(atomic_sub_and_test(RUNBIAS-totalcount,&(record->rcrRecords["+index+"].count))) {");
-      cFile.println("        int flag=LOCKXCHG(&(record->rcrRecords["+index+"].flag),0);");
+      cFile.println("        int flag=LOCKXCHG32(&(record->rcrRecords["+index+"].flag),0);");
       cFile.println("        if(flag) {");
       //we have resolved a heap root...see if this was the last dependence
       cFile.println("            if(atomic_sub_and_test(1, &(record->common.unresolvedDependencies))) workScheduleSubmit((void *)record);");
@@ -767,24 +768,27 @@ public class RuntimeConflictResolver {
       int allocSiteID = connectedHRHash.get(taint).getWaitingQueueBucketNum(node);
       int traverserID = doneTaints.get(taint);
       if (objConfRead)
-       currCase.append("    int tmpvar=rcr_WTWRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
+       currCase.append("    int tmpvar"+depth+"=rcr_WTWRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
       else
-       currCase.append("    int tmpvar=rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
+       currCase.append("    int tmpvar"+depth+"=rcr_WRITEBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (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);
       if (objConfRead) 
-       currCase.append("    int tmpvar=rcr_WTREADBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
+       currCase.append("    int tmpvar"+depth+"=rcr_WTREADBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
       else
-       currCase.append("    int tmpvar=rcr_READBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
+       currCase.append("    int tmpvar"+depth+"=rcr_READBINCASE(allHashStructures["+heaprootNum+"],"+prefix+", (SESEcommon *) record, "+index+");\n");
     }
 
-    currCase.append("if (!(tmpvar&READYMASK)) totalcount--;\n");
-    currCase.append("if (!(tmpvar&SPEC)) ; //add record\n");
-    
-    //Conflicts
+    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++];");
+      currCase.append("}\n");
+    }
     
     //Array Case
     if(node.isObjectArray() && node.decendantsConflict()) {
index 0eb089f85778ffa911dc7469bb1a2e9344178e70..2b31b2e1a532bf0cebc6ce8377dc8d6a500b9379 100644 (file)
@@ -3,6 +3,7 @@
 #include "mlp_lock.h"
 #include "mem.h"
 #include "classdefs.h"
+#include "rcr_runtime.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
@@ -11,7 +12,6 @@ HashStructure ** allHashStructures;
 #define ISREADBIN(x) (!(x&BINMASK))
 //#define POPCOUNT(x) __builtin_popcountll(x)
 //__builtin_popcountll
-#define RESOLVE(x) 
 
 
 //NOTE: only temporary
@@ -288,7 +288,7 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key) {
        if (ptr->status==NOTREADY) {
          ReadBinItem_rcr* rptr=(ReadBinItem_rcr*)ptr;
          for (i=0;i<rptr->index;i++) {
-           TaskDescriptor * td=&rptr->array[i];
+           TraverserData * td=&rptr->array[i];
            RESOLVE(td->task, td->bitindex);
             if (((INTPTR)rptr->array[i].task)&PARENTBIN) {
               //parents go immediately
@@ -329,14 +329,14 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key) {
 
 void RESOLVE(SESEcommon *record, bitvt mask) {
   int index=-1;
-  struct rcrRecord * array=(struct rcrRecord *)(((char *)record)+record->common.offsetToParamRecords);
+  struct rcrRecord * array=(struct rcrRecord *)(((char *)record)+record->offsetToParamRecords);
   while(mask!=0) {
     int shift=__builtin_ctzll(mask)+1;
     index+=shift;
     if (atomic_sub_and_test(1,&array[index].count)) {
-      inf flag=LOCKXCHG(&array[index].flag,0);
+      int flag=LOCKXCHG32(&array[index].flag,0);
       if (flag) {
-       if(atomic_sub_and_test(1, &(record->common.unresolvedDependencies))) 
+       if(atomic_sub_and_test(1, &(record->unresolvedDependencies))) 
          workScheduleSubmit((void *)record);
       }
     }
index 479a6276622eca7d3ab2e35a09616b29222153ed..946945c613948972e652ca45e1b4f8a62dca5211 100644 (file)
@@ -83,6 +83,7 @@ inline int rcr_generateKey(void * ptr);
 //Method signatures are not in their final form since I have still not decided what is the optimum amount of data
 //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_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index);