bug fixes
authorbdemsky <bdemsky>
Sun, 24 Oct 2010 08:56:28 +0000 (08:56 +0000)
committerbdemsky <bdemsky>
Sun, 24 Oct 2010 08:56:28 +0000 (08:56 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/RuntimeConflictResolver.java
Robust/src/Runtime/mlp_runtime.h
Robust/src/Runtime/oooJava/hashStructure.c
Robust/src/Runtime/oooJava/rcr_runtime.h
Robust/src/Tests/rcr/test.java

index e047e48a2a3962ed9deb8e6b78028a195f855940..e14ff60a4c7b607e712de8ad4eb04b34c11e83e2 100644 (file)
@@ -3943,7 +3943,7 @@ public class BuildCode {
     
     if(state.RCR) {
       //flag the SESE status as 1...it will be reset
-      output.println("     seseToIssue->rcrstatus=1;");
+      output.println("     seseToIssue->common.rcrstatus=1;");
     }
 
     // there are pointers to SESE records the newly-issued SESE
@@ -4603,7 +4603,7 @@ public class BuildCode {
       output.println("    struct rcrRecord *rec="+paramsprefix+"->rcrRecords[idx];");
       output.println("    while(rec!=NULL) {");
       output.println("      for(idx2=0;idx2<rec->index;idx2++) {");
-      output.println("        rcr_RETIREHASHTABLE(allHashStructures[0],rec,rec->array[idx2], rcr->ptrarray[idx2]);");
+      output.println("        rcr_RETIREHASHTABLE(allHashStructures[0],rec,rec->array[idx2], (BinItem_rcr *) rcr->ptrarray[idx2]);");
       output.println("      }");//exit idx2 for loop
       output.println("      rec=rec->next;");
       output.println("    }");//exit rec while loop
index bf2da26c0ea845e93955750f97533a5bf0cb2178..abc069c34cecbd81bf3d1695a16886213ec4717f 100644 (file)
@@ -723,8 +723,8 @@ public class RuntimeConflictResolver {
       //Casts the ptr to a generic object struct so we can get to the ptr->allocsite field. 
       cFile.println("struct ___Object___ * ptr = (struct ___Object___ *) InVar;\nif (InVar != NULL) {\n " + queryVistedHashtable + "(ptr);\n do {");
       if (taint.isRBlockTaint()) {
-       cFile.println("  if(unlikely(record->doneExecuting)) {");
-       cFile.println("    record->rcrstatus=0;");
+       cFile.println("  if(unlikely(record->common.doneExecuting)) {");
+       cFile.println("    record->common.rcrstatus=0;");
        cFile.println("    return;");
        cFile.println("  }");
       }
index 6a79d80dc2e3224022dcf0c4c2f936a5b2e8d792..04928a293ae95d841965cdcbad0be599960df0a3 100644 (file)
@@ -158,6 +158,29 @@ typedef struct REntry_t{
   int isBufMode;
 } REntry;
 
+#ifdef RCR
+#define RCRSIZE 32
+#define RUNBIAS 1000000
+
+struct rcrRecord {
+  int count;
+  int index;
+  int flag;
+  int array[RCRSIZE];
+  void * ptrarray[RCRSIZE];
+  struct rcrRecord *next;
+};
+
+typedef struct SESEstall_t { 
+  SESEcommon common;
+  int size;
+  void * next;
+  struct ___Object___* ___obj___;
+  struct rcrRecord rcrRecords[1];
+  int tag;
+} SESEstall;
+#endif
+
 typedef struct MemoryQueueItem_t {
   int type; // hashtable:0, vector:1, singleitem:2
   int total;        //total non-retired
index 2c8922e9553674358dd04170f6c424867ab7c773..1fcd5ce2d10756f8bda69e567b42d28e71af2ecc 100644 (file)
@@ -1,9 +1,10 @@
 #include "hashStructure.h"
 //#include "WaitingQueue.h"
 #include "mlp_lock.h"
+#include "rcr_runtime.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
@@ -19,15 +20,15 @@ inline enqueuerecord(struct rcrRecord *rcrrec, int tmpkey, BinItem_rcr *item) {
     struct rcrRecord * tmprec;
     if(likely(rcrrec->index<RCRSIZE)) {
       int index=rcrrec->index++;
-      rcrrec->ptrarray[index]=item;
+      rcrrec->ptrarray[index]=(void *) item;
       rcrrec->array[index]=tmpkey;
     } else if(likely((tmprec=rcrrec->next)!=NULL)&&likely(tmprec->index<RCRSIZE)) {
       int index=tmprec->index++;
-      tmprec->ptrarray[index]=item;
+      tmprec->ptrarray[index]=(void *) item;
       tmprec->array[index]=tmpkey;
     } else {
       struct rcrRecord *trec=RUNMALLOC(sizeof(struct rcrRecord));
-      trec->ptrarray[0]=item;
+      trec->ptrarray[0]=(void *) item;
       trec->array[0]=tmpkey;
       trec->index=1;
       trec->next=tmprec;
@@ -161,7 +162,7 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct
        if (status&SPEC) {
          return READY;
        } else {
-         enqueuerecord(rcrrec, key, b);
+         enqueuerecord(rcrrec, key, (BinItem_rcr *) b);
          return READY;
        }
       }
@@ -178,7 +179,7 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct
     return status&READY;
   } else {
     if (!(status&SPEC))
-      enqueuerecord(rcrrec, key, b);      
+      enqueuerecord(rcrrec, key, (BinItem_rcr *) b);
     return status&READY;
   }
 }
@@ -186,13 +187,13 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct
 inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct rcrRecord *rcrrec, int index, int mode) {
   BinItem_rcr * val;
   BinElement_rcr * be = &(T->array[key]);
-
+  
   //LOCK is still needed as different threads will remove items...
   do {  
     val=(BinItem_rcr *)0x1;       
     val=(BinItem_rcr *)LOCKXCHG((unsigned INTPTR*)&(be->head), (unsigned INTPTR)val);
   } while(val==(BinItem_rcr*)0x1);     
-
+  
   if (val==NULL) {
     BinItem_rcr * b=(BinItem_rcr*)rcr_createReadBinItem();
     ReadBinItem_rcr* readbin=(ReadBinItem_rcr*)b;
@@ -213,7 +214,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct
 
 
   BinItem_rcr * bintail=be->tail;
-
+  
   //check if already added item or not.
   if (ISWRITEBIN(bintail->type)) {
     WriteBinItem_rcr * td = (WriteBinItem_rcr *)bintail;
@@ -235,6 +236,7 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct
       } else {
        return status;
       }
+    }
   } else {
     TraverserData * td = &((ReadBinItem_rcr *)bintail)->array[((ReadBinItem_rcr *)bintail)->index - 1];
     if (unlikely(td->task==task)) {
@@ -316,11 +318,11 @@ int rcr_WTREADBINCASE(HashStructure *T, int key, SESEcommon * task, struct rcrRe
     rb->item.status=status;
     T->array[key].tail->next=(BinItem_rcr*)rb;
     T->array[key].tail=(BinItem_rcr*)rb;
-    enqueuerecord(rcrrec, key, rb);
+    enqueuerecord(rcrrec, key, (BinItem_rcr *) rb);
   } else { // group into old tail
     td = &readbintail->array[readbintail->index++];
     atomic_inc(&readbintail->item.total);
-    enqueuerecord(rcrrec, key, readbintail);
+    enqueuerecord(rcrrec, key, (BinItem_rcr *) readbintail);
   }
 
   td->task=task;
@@ -338,7 +340,7 @@ void rcr_TAILWRITECASE(HashStructure *T, BinItem_rcr *val, BinItem_rcr *bintail,
 
   td->task=task;
   td->bitindex=1<<index;
-  enqueuerecord(rcrrec, key, rb);
+  enqueuerecord(rcrrec, key, (BinItem_rcr *) rb);
 
   T->array[key].tail->next=(BinItem_rcr*)rb;
   T->array[key].tail=(BinItem_rcr*)rb;
@@ -352,7 +354,7 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key, BinItem_rc
       return;
     }
   }
-
+  
   //We either have a write bin or we are at the end of a read bin
   BinElement_rcr * be = &(T->array[key]);
   {
@@ -414,7 +416,7 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key, BinItem_rc
     be->head=val; // release lock
   }
 }
-
 void RESOLVE(SESEcommon *record, bitvt mask) {
   int index=-1;
   struct rcrRecord * array=(struct rcrRecord *)(((char *)record)+record->offsetToParamRecords);
index cc341806999f35a28e7369b531ff72580538d932..aa2ad3f3204d849955e4c5d4899f4ac5594a0f5d 100644 (file)
@@ -5,26 +5,5 @@ extern __thread struct trQueue * TRqueue;
 
 void * workerTR(void *);
 
-#define RCRSIZE 32
-#define RUNBIAS 1000000
-
-struct rcrRecord {
-  int count;
-  int index;
-  int flag;
-  int array[RCRSIZE];
-  BinItem_rcr *ptrarray[RCRSIZE];
-  struct rcrRecord *next;
-};
-
-typedef struct SESEstall_t { 
-  SESEcommon common;
-  int size;
-  void * next;
-  struct ___Object___* ___obj___;
-  struct rcrRecord rcrRecords[1];
-  int tag;
-} SESEstall;
-
 extern __thread SESEstall stallrecord;
 #endif
index 9e816e812eb7dccb8864ba44c8cf09ed01dd10bf..601cc36176a0423bbc1ccc40df8083fb9dd91fd6 100644 (file)
@@ -5,7 +5,11 @@ public class test {
   public static void main(String xz[]) {
     test[] r=new test[10];
     for(int i=0;i<10;i++) {
-      r[i]=new test();r[i].f=new foo();
+      r[i]=new test();
+      //      if (i%2==0)
+       r[i].f=new foo();
+       //      else
+       //      r[i].f=new foo();
     }
 
     for (int z=0;z<100000;z++) {