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);");
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()) {
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()+"];");
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 );");
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);
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;
}
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);
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
}
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)) {
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
}
}
}
}
+#ifndef RCR
int RESOLVEBUF(MemoryQueue * q, SESEcommon *seseCommon){
int localCount=0;
int i;
table->unresolvedQueue=val;//released lock;
}
}
-
-void rehashMemoryQueue(SESEcommon* seseParent){
-}
+#endif
// 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;
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) );