changes
authorbdemsky <bdemsky>
Tue, 9 Nov 2010 06:20:41 +0000 (06:20 +0000)
committerbdemsky <bdemsky>
Tue, 9 Nov 2010 06:20:41 +0000 (06:20 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/garbage.c
Robust/src/Runtime/mlp_runtime.c
Robust/src/Runtime/mlp_runtime.h

index 158d7b789fd2772a1c5e13baeccf3ac570b019af..156dc737ce0fd6cd93eb23fddf93a44818e0315d 100644 (file)
@@ -3115,7 +3115,7 @@ public class BuildCode {
     output.println("     // when you call RELEASE_REFERENCE_TO on a stall record.");
     output.println("     // so the parent field must be initialized.");
     output.println("     SESEstall * stallrecord=(SESEstall *) poolalloc(runningSESE->taskRecordMemPool);");    
-    output.println("     stallrecord->common.parent=runningSESE;");    
+    output.println("     stallrecord->common.parent=runningSESE;");
     output.println("     stallrecord->common.unresolvedDependencies=10000;");
     output.println("     stallrecord->common.rcrstatus=1;");
     output.println("     stallrecord->common.offsetToParamRecords=(INTPTR) & (((SESEstall *)0)->rcrRecords);");
@@ -3141,8 +3141,12 @@ public class BuildCode {
       output.println("     rentry->queue=runningSESE->memoryQueueArray["
                     + waitingElement.getQueueID() + "];");
       output.println("     if(ADDRENTRY(runningSESE->memoryQueueArray["
-                    + waitingElement.getQueueID() + "],rentry)==NOTREADY) ");
+                    + waitingElement.getQueueID() + "],rentry)==NOTREADY) {");
       output.println("       localCount--;");
+      output.println("     }");
+      output.println("#if defined(RCR)&&!defined(OOO_DISABLE_TASKMEMPOOL)");
+      output.println("     else poolfreeinto(runningSESE->memoryQueueArray["+waitingElement.getQueueID()+"]->rentrypool, rentry);");
+      output.println("#endif");
       if (stalltd==null) {
        stalltd=waitingElement.getTempDesc();
       } else if (stalltd!=waitingElement.getTempDesc()) {
@@ -4576,6 +4580,7 @@ public class BuildCode {
            assert(waitingElement.getStatus()>=ConflictNode.COARSE);
            long mask=queuetovar.get(queueID);
            output.println("       rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "]," + waitingElement.getStatus() + ", &(seseToIssue->common), "+mask+"LL);");
+           output.println("       rentry->count=2;");
            output.println("       seseToIssue->common.rentryArray[seseToIssue->common.rentryIdx++]=rentry;");
            output.println("       rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID()+"];");
            
@@ -4716,13 +4721,15 @@ public class BuildCode {
     output.println("     SESEcommon* consumer = (SESEcommon*) getItem( &runningSESE->forwardList );");
     
    
-    output.println("     if(consumer->rentryIdx>0){");
-    output.println("        // resolved null pointer");
-    output.println("        int idx;");
-    output.println("        for(idx=0;idx<consumer->rentryIdx;idx++){");
-    output.println("           resolvePointer(consumer->rentryArray[idx]);");
-    output.println("        }");
-    output.println("     }");
+    if (!state.RCR) {
+      output.println("     if(consumer->rentryIdx>0){");
+      output.println("        // resolved null pointer");
+      output.println("        int idx;");
+      output.println("        for(idx=0;idx<consumer->rentryIdx;idx++){");
+      output.println("           resolvePointer(consumer->rentryArray[idx]);");
+      output.println("        }");
+      output.println("     }");
+    }
 
     output.println("     if( atomic_sub_and_test( 1, &(consumer->unresolvedDependencies) ) ){");
     output.println("       workScheduleSubmit( (void*)consumer );");
index 262b82bd10af68a9e4fa580536d3c5059c1970f4..9094dd647319c5667111a648c181c690cd473846 100644 (file)
@@ -723,17 +723,6 @@ void collect(struct garbagelist * stackptr) {
   fixtags();
 #endif
 
-#ifdef MLP
-  {
-    //rehash memory queues of current running SESEs
-    struct listitem *listptr=list;
-    while(listptr!=NULL){
-      rehashMemoryQueue((SESEcommon*)(listptr->seseCommon));
-      listptr=listptr->next;
-    }
-  }
-#endif
-
 #if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
   needtocollect=0;
   pthread_mutex_unlock(&gclistlock);
index 5dcf2b97634d384865ce851a9dffb70c54ece8c3..ad1542b53954f11475436f832674e5b30bd4a5a0 100644 (file)
@@ -497,15 +497,15 @@ void TAILWRITECASE(Hashtable *T, REntry *r, BinItem *val, BinItem *bintail, int
 int ADDVECTOR(MemoryQueue *Q, REntry *r) {
   if(!isVector(Q->tail)) {
     //Fast Case
-    if (isParentCoarse(r) && Q->tail->total==0 && Q->tail==Q->head) { 
+    if (isParentCoarse(r) && Q->tail->total==0 && Q->tail==Q->head) {
       return READY;
     }
 
     //added vector
     Vector* V=createVector();
-    Q->tail->next=(MemoryQueueItem*)V;     
+    Q->tail->next=(MemoryQueueItem*)V;
     //************NEED memory barrier here to ensure compiler does not cache Q.tail.status******
-    if (BARRIER() && Q->tail->status==READY&&Q->tail->total==0) { 
+    if (BARRIER() && Q->tail->status==READY&&Q->tail->total==0) {
       //previous Q item is finished
       V->item.status=READY;
     }
@@ -541,7 +541,7 @@ int ADDVECTOR(MemoryQueue *Q, REntry *r) {
   r->qitem=(MemoryQueueItem *)V;
   if (BARRIER() && V->item.status==READY) {
     void* flag=NULL;
-    flag=(void*)LOCKXCHG((unsigned INTPTR*)&(V->array[index]), (unsigned INTPTR)flag); 
+    flag=(void*)LOCKXCHG((unsigned INTPTR*)&(V->array[index]), (unsigned INTPTR)flag);
     if (flag!=NULL) {
       if (isParentCoarse(r)) { //parent's retire immediately
         atomic_dec(&V->item.total);
@@ -597,7 +597,10 @@ void RETIRERENTRY(MemoryQueue* Q, REntry * r) {
     RETIRESCC(Q, r);
   }
 #ifndef OOO_DISABLE_TASKMEMPOOL
-  poolfreeinto(Q->rentrypool, r);
+#ifdef RCR
+  if(atomic_sub_and_test(1, &r->count))
+#endif
+    poolfreeinto(Q->rentrypool, r);
 #endif
 }
 
@@ -788,8 +791,15 @@ void RESOLVEVECTOR(MemoryQueue *q, Vector *V) {
       if (val!=NULL) { 
        resolveDependencies(val);
        if (isParent(val)) {
-          atomic_dec(&tmp->item.total);
-        }
+         atomic_dec(&tmp->item.total);
+#ifdef RCR
+         poolfreeinto(q->rentrypool,val);
+#endif
+       }
+#if defined(RCR)&&defined(OOO_DISABLE_TASKMEMPOOL)
+       else if (atomic_sub_and_test(1, &((REntry *)val)->count))
+         poolfreeinto(q->rentrypool,val);
+#endif
       }
     }
     if (tmp->item.next!=NULL&&isVector(tmp->item.next)) {
@@ -806,6 +816,10 @@ void RESOLVESCC(SCC *S) {
   flag=(void*)LOCKXCHG((unsigned INTPTR*)&(S->val), (unsigned INTPTR)flag); 
   if (flag!=NULL) {
     resolveDependencies(flag);
+#if defined(RCR)&&defined(OOO_DISABLE_TASKMEMPOOL)
+    if (atomic_sub_and_test(1, &((REntry *)flag)->count))
+      poolfreeinto(q->rentrypool, flag);
+#endif
   }
 }
 
@@ -905,6 +919,7 @@ int RESOLVEBUFFORHASHTABLE(MemoryQueue * q, Hashtable* table, SESEcommon *seseCo
   }
 }
 
+#ifndef RCR
 int RESOLVEBUF(MemoryQueue * q, SESEcommon *seseCommon){
   int localCount=0;
   int i;
@@ -1044,6 +1059,4 @@ void resolvePointer(REntry* rentry){
     table->unresolvedQueue=val;//released lock;
   }  
 }
-
-void rehashMemoryQueue(SESEcommon* seseParent){    
-}
+#endif
index 2d51ac97bbb62485a795af66402aef93e6b55c16..3e1610e042bd2fede3caad119c63800e355bc8a1 100644 (file)
@@ -148,7 +148,11 @@ typedef struct REntry_t{
   // fine read:0, fine write:1, parent read:2, 
   // parent write:3 coarse: 4, parent coarse:5, scc: 6
   int type;
+#ifdef RCR
+  int count;
+#else
   int isBufMode;
+#endif
   struct MemoryQueueItem_t *qitem;
   struct BinItem_t* binitem;
   struct MemoryQueue_t* queue;
@@ -280,6 +284,10 @@ void RESOLVEVECTOR(MemoryQueue *q, Vector *V);
 void RESOLVESCC(SCC *S);
 void resolveDependencies(REntry* rentry);
 
+#ifndef RCR
+int RESOLVEBUF(MemoryQueue * q, SESEcommon *seseCommon);
+void resolvePointer(REntry* rentry);
+#endif
 
 static inline void ADD_REFERENCE_TO( SESEcommon* seseRec ) {
   atomic_inc( &(seseRec->refCount) );