From 6cc4b6daf50c77932bd797a8fd4a3de582e44f48 Mon Sep 17 00:00:00 2001 From: yeom Date: Fri, 5 Nov 2010 20:45:31 +0000 Subject: [PATCH] have an exceptional case that do not generate fine rentry when parent has a coarse edge with non-parent node. --- .../src/Analysis/OoOJava/OoOJavaAnalysis.java | 36 +++++-- Robust/src/IR/Flat/BuildCode.java | 96 +++++++++++-------- 2 files changed, 84 insertions(+), 48 deletions(-) diff --git a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java index 9ec6c2d6..f908fa90 100644 --- a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java +++ b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java @@ -1320,15 +1320,23 @@ public class OoOJavaAnalysis { // and it is not parent type = ConflictNode.SCC; } else { - type = ConflictNode.PARENT_WRITE; + if(state.RCR){ + type = ConflictNode.PARENT_COARSE; + }else{ + type = ConflictNode.PARENT_WRITE; + } } seseLock.addConflictNode(edge.getVertexU(), type); } else { if (edge.getVertexU().isStallSiteNode()) { - if (edge.getVertexU().getWriteEffectSet().isEmpty()) { - type = ConflictNode.PARENT_READ; - } else { - type = ConflictNode.PARENT_WRITE; + if(state.RCR){ + type = ConflictNode.PARENT_COARSE; + }else{ + if (edge.getVertexU().getWriteEffectSet().isEmpty()) { + type = ConflictNode.PARENT_READ; + } else { + type = ConflictNode.PARENT_WRITE; + } } } else { type = ConflictNode.COARSE; @@ -1341,15 +1349,23 @@ public class OoOJavaAnalysis { // and it is not parent type = ConflictNode.SCC; } else { - type = ConflictNode.PARENT_WRITE; + if(state.RCR){ + type = ConflictNode.PARENT_COARSE; + }else{ + type = ConflictNode.PARENT_WRITE; + } } seseLock.addConflictNode(edge.getVertexV(), type); } else { if (edge.getVertexV().isStallSiteNode()) { - if (edge.getVertexV().getWriteEffectSet().isEmpty()) { - type = ConflictNode.PARENT_READ; - } else { - type = ConflictNode.PARENT_WRITE; + if(state.RCR){ + type = ConflictNode.PARENT_COARSE; + }else{ + if (edge.getVertexV().getWriteEffectSet().isEmpty()) { + type = ConflictNode.PARENT_READ; + } else { + type = ConflictNode.PARENT_WRITE; + } } } else { type = ConflictNode.COARSE; diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 18e878e2..92ef2616 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3285,61 +3285,81 @@ public class BuildCode { Set seseLockSet = oooa.getLockMappings(graph); Set waitingElementSet = graph.getStallSiteWaitingElementSet(fn, seseLockSet); - if(waitingElementSet.size()>0){ + if (waitingElementSet.size() > 0) { output.println("// stall on parent's stall sites "); output.println(" {"); output.println(" REntry* rentry;"); - + 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(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+waitingElement.getStatus()+ ", runningSESE);"); - }else{ - output.println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()+ "],"+ waitingElement.getStatus()+ ", runningSESE, (void*)&" +generateTemp(fm,waitingElement.getTempDesc(),lb)+ ");"); - } - output.println(" rentry->parentStallSem=&runningSESEstallSem;"); + Analysis.OoOJava.WaitingElement waitingElement = + (Analysis.OoOJava.WaitingElement) iterator.next(); + if (waitingElement.getStatus() >= ConflictNode.COARSE) { + if (state.RCR) { + output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray[" + + waitingElement.getQueueID() + "]," + waitingElement.getStatus() + + ", runningSESE, 1LL);"); + } else { + output.println(" rentry=mlpCreateREntry(runningSESE->memoryQueueArray[" + + waitingElement.getQueueID() + "]," + waitingElement.getStatus() + + ", runningSESE);"); + } + } else { + output.println(" rentry=mlpCreateFineREntry(runningSESE->memoryQueueArray[" + + waitingElement.getQueueID() + "]," + waitingElement.getStatus() + + ", runningSESE, (void*)&" + + generateTemp(fm, waitingElement.getTempDesc(), lb) + ");"); + } + 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(" 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("#ifdef CP_EVENTID_TASKSTALLMEM"); - output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );"); + output + .println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );"); output.println("#endif"); } - if(state.RCR) { - //no need to enqueue parent effect if coarse grained conflict clears us + if (state.RCR) { + // no need to enqueue parent effect if coarse grained conflict + // clears us - output.println(" while(stallrecord.common.rcrstatus) BARRIER();"); + output.println(" while(stallrecord.common.rcrstatus) BARRIER();"); // was the code above actually meant to look like this? - //output.println(" while(stallrecord.common.rcrstatus) {"); - //output.println(" BARRIER();"); - //output.println(" sched_yield();"); - //output.println(" }"); - - - 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)+";"); - //mark the record used..so we won't use it again until it is free - //clear rcrRecord - output.println(" stallrecord.rcrRecords[0].index=0;"); - output.println(" stallrecord.rcrRecords[0].flag=0;"); - output.println(" stallrecord.rcrRecords[0].next=NULL;"); - output.println(" stallrecord.common.rcrstatus=1;"); - output.println(" enqueueTR(TRqueue, (void *)&stallrecord);"); + // output.println(" while(stallrecord.common.rcrstatus) {"); + // output.println(" BARRIER();"); + // output.println(" sched_yield();"); + // output.println(" }"); + + 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) + ";"); + // mark the record used..so we won't use it again until it is + // free + // clear rcrRecord + output.println(" stallrecord.rcrRecords[0].index=0;"); + output.println(" stallrecord.rcrRecords[0].flag=0;"); + output.println(" stallrecord.rcrRecords[0].next=NULL;"); + output.println(" stallrecord.common.rcrstatus=1;"); + output.println(" enqueueTR(TRqueue, (void *)&stallrecord);"); } - output.println(" psem_take( &runningSESEstallSem, (struct garbagelist *)&___locals___ );"); + output + .println(" psem_take( &runningSESEstallSem, (struct garbagelist *)&___locals___ );"); - if( state.RCR ) { + if (state.RCR) { output.println(" stallrecord.common.rcrstatus=0;"); } - if( state.COREPROF ) { + if (state.COREPROF) { output.println("#ifdef CP_EVENTID_TASKSTALLMEM"); - output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );"); + output + .println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );"); output.println("#endif"); } output.println(" } "); -- 2.34.1