for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
Analysis.OoOJava.WaitingElement waitingElement = (Analysis.OoOJava.WaitingElement) iterator.next();
if( waitingElement.getStatus() >= ConflictNode.COARSE ){
- output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", runningSESE);");
+ output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+waitingElement.getStatus()+ ", runningSESE);");
}else{
- output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", runningSESE, (void*)&" +generateTemp(fm,waitingElement.getTempDesc(),lb)+ ");");
+ output.println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+ waitingElement.getStatus()+ ", runningSESE, (void*)&" +generateTemp(fm,waitingElement.getTempDesc(),lb)+ ");");
}
- output.println(" psem_init( &(rentry->parentStallSem) );");
- output.println(" rentry->tag=rentry->parentStallSem.tag;");
+ output.println(" rentry->parentStallSem=&runningSESEstallSem;");
+ output.println(" psem_reset( &runningSESEstallSem);");
+ output.println(" rentry->tag=runningSESEstallSem.tag;");
output.println(" rentry->queue=runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],rentry)==NOTREADY){");
if( state.COREPROF ) {
//no need to enqueue parent effect if coarse grained conflict clears us
output.println(" while(stallrecord.common.rcrstatus) ;");
output.println(" BARRIER();");
- output.println(" stallrecord.common.parentsStallSem=&rentry->parentStallSem;");
+ output.println(" stallrecord.common.parentsStallSem=&runningSESEstallSem;");
output.println(" stallrecord.tag=rentry->tag;");
output.println(" stallrecord.___obj___=(struct ___Object___ *)"+generateTemp(fm, waitingElement.getTempDesc(), null)+";");
output.println(" stallrecord.common.classID=-"+rcr.getTraverserID(waitingElement.getTempDesc(), fn)+";");
output.println(" stallrecord.common.rcrstatus=1;");
output.println(" enqueueTR(TRqueue, (void *)&stallrecord);");
}
- output.println(" psem_take( &(rentry->parentStallSem), (struct garbagelist *)&___locals___ );");
+ output.println(" psem_take( &runningSESEstallSem, (struct garbagelist *)&___locals___ );");
if( state.COREPROF ) {
output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
if( waitingElement.getStatus() >= ConflictNode.COARSE ){
// HERE! a parent might conflict with a child
- output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", runningSESE);");
+ output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+ waitingElement.getStatus()+ ", runningSESE);");
} else {
- output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", runningSESE, (void*)&___locals___."+ waitingElement.getDynID() + ");");
+ output.println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+ waitingElement.getStatus()+ ", runningSESE, (void*)&___locals___."+ waitingElement.getDynID() + ");");
}
- output.println(" psem_init(&(rentry->parentStallSem));");
- output.println(" rentry->tag=rentry->parentStallSem->tag;");
+ output.println(" rentry->parentStallSem=&runningSESEstallSem;");
+ output.println(" psem_reset( &runningSESEstallSem);");
+ output.println(" rentry->tag=runningSESEstallSem.tag;");
output.println(" rentry->queue=runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+"],rentry)==NOTREADY) {");
if( state.COREPROF ) {
output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
output.println("#endif");
}
- output.println(" psem_take( &(rentry->parentStallSem), (struct garbagelist *)&___locals___ );");
+ output.println(" psem_take( &runningSESEstallSem, (struct garbagelist *)&___locals___ );");
if( state.COREPROF ) {
output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
Analysis.OoOJava.WaitingElement waitingElement
= (Analysis.OoOJava.WaitingElement) iterator2.next();
if (waitingElement.getStatus() >= ConflictNode.COARSE) {
- output.println(" rentry=mlpCreateREntry("
+ output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ queueID+ "],"
+ waitingElement.getStatus()
+ ", &(seseToIssue->common));");
} else {
+ "_srcSESE+seseToIssue->"
+ waitingElement.getDynID()
+ "_srcOffset;");
- output.println(" rentry=mlpCreateFineREntry("
+ output.println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray["+ queueID+ "],"
+ waitingElement.getStatus()
+ ", &(seseToIssue->common), pointer );");
} else if (fsen.getStaticInVarSet().contains(td)) {
WaitingElement waitingElement = (WaitingElement) iterator2
.next();
if (waitingElement.getStatus() >= ConflictNode.COARSE) {
- output.println(" rentry=mlpCreateREntry("
+ output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ queueID+ "],"
+ waitingElement.getStatus()
+ ", &(seseToIssue->common));");
} else {
+ waitingElement.getDynID()
+ "_srcOffset;");
output
- .println(" rentry=mlpCreateFineREntry("
+ .println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray["+ queueID+ "],"
+ waitingElement
.getStatus()
+ ", &(seseToIssue->common), pointer );");
Analysis.OoOJava.WaitingElement waitingElement=wtit.next();
int queueID=waitingElement.getQueueID();
assert(waitingElement.getStatus()>=ConflictNode.COARSE);
- output.println(" rentry=mlpCreateREntry(" + waitingElement.getStatus() + ", &(seseToIssue->common));");
+ output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "]," + waitingElement.getStatus() + ", &(seseToIssue->common));");
output.println(" seseToIssue->common.rentryArray[seseToIssue->common.rentryIdx++]=rentry;");
output.println(" rentry->queue=runningSESE->memoryQueueArray[" + waitingElement.getQueueID()+"];");
output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],rentry)==READY) {");
output.println("#endif // OOO_DISABLE_TASKMEMPOOL" );
+ output.println("{");
+ output.println("SESEcommon *myparent=runningSESE->parent;");
+
// if this is not the Main sese (which has no parent) then return
// THIS task's record to the PARENT'S task record pool, and only if
// the reference count is now zero
// last of all, decrement your parent's number of running children
- output.println(" if( runningSESE->parent != NULL ) {");
- output.println(" if( atomic_sub_and_test( 1, &(runningSESE->parent->numRunningChildren) ) ) {");
- output.println(" pthread_mutex_lock ( &(runningSESE->parent->lock) );");
- output.println(" pthread_cond_signal ( &(runningSESE->parent->runningChildrenCond) );");
- output.println(" pthread_mutex_unlock( &(runningSESE->parent->lock) );");
+ output.println(" if( myparent != NULL ) {");
+ output.println(" if( atomic_sub_and_test( 1, &(myparent->numRunningChildren) ) ) {");
+ output.println(" pthread_mutex_lock ( &(myparent->lock) );");
+ output.println(" pthread_cond_signal ( &(myparent->runningChildrenCond) );");
+ output.println(" pthread_mutex_unlock( &(myparent->lock) );");
output.println(" }");
output.println(" }");
+ output.println("}");
// as this thread is wrapping up the task, make sure the thread-local var
// for the currently running task record references an invalid task
return newMemoryQueue;
}
-REntry* mlpCreateREntryArray(){
- REntry* newREntryArray=(REntry*)RUNMALLOC(sizeof(REntry)*NUMRENTRY);
- return newREntryArray;
-}
-
-REntry* mlpCreateFineREntry(int type, SESEcommon* seseToIssue, void* dynID){
+REntry* mlpCreateFineREntry(MemoryQueue* q, int type, SESEcommon* seseToIssue, void* dynID){
+#ifdef OOO_DISABLE_TASKMEMPOOL
REntry* newREntry=(REntry*)RUNMALLOC(sizeof(REntry));
+#else
+ REntry* newREntry=poolalloc(q->rentrypool);
+#endif
newREntry->type=type;
newREntry->seseRec=seseToIssue;
newREntry->pointer=dynID;
return newREntry;
}
-REntry* mlpCreateREntry(int type, SESEcommon* seseToIssue){
+REntry* mlpCreateREntry(MemoryQueue* q, int type, SESEcommon* seseToIssue){
+#ifdef OOO_DISABLE_TASKMEMPOOL
REntry* newREntry=(REntry*)RUNMALLOC(sizeof(REntry));
+#else
+ REntry* newREntry=poolalloc(q->rentrypool);
+#endif
newREntry->type=type;
newREntry->seseRec=seseToIssue;
return newREntry;
dummy->status=READY;
queue->head = dummy;
queue->tail = dummy;
+#ifndef OOO_DISABLE_TASKMEMPOOL
+ queue->rentrypool = poolcreate(sizeof(REntry));
+#endif
return queue;
}
} else if (isSCC(r)) {
RETIRESCC(Q, r);
}
+#ifndef OOO_DISABLE_TASKMEMPOOL
+ poolfreeinto(Q->rentrypool, r);
+#endif
}
RETIRESCC(MemoryQueue *Q, REntry *r) {
workScheduleSubmit(seseCommon);
}
}else if(rentry->type==PARENTREAD || rentry->type==PARENTWRITE ||rentry->type==PARENTCOARSE){
- psem_give_tag(&(rentry->parentStallSem), rentry->tag);
+ psem_give_tag(rentry->parentStallSem, rentry->tag);
}
}