From: yeom Date: Sun, 14 Nov 2010 01:53:05 +0000 (+0000) Subject: fix: had a bug when one coarse entry handles more than one parameter conflicts X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=16566aef3f1119fa98ad65fb90d53c2c7de2ac09;p=IRC.git fix: had a bug when one coarse entry handles more than one parameter conflicts --- diff --git a/Robust/src/Analysis/OoOJava/ConflictGraph.java b/Robust/src/Analysis/OoOJava/ConflictGraph.java index ae569b8d..d3f47c86 100644 --- a/Robust/src/Analysis/OoOJava/ConflictGraph.java +++ b/Robust/src/Analysis/OoOJava/ConflictGraph.java @@ -634,7 +634,6 @@ public class ConflictGraph { SCCelement = waitingElement; } } - if (SCCelement != null) { // if there is at lease one SCC element, just enqueue SCC and // ignore others. @@ -644,10 +643,14 @@ public class ConflictGraph { for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) { WaitingElement waitingElement = (WaitingElement) iterator.next(); SCCelement.addTempDesc(waitingElement.getTempDesc()); + if(waitingElement!=SCCelement){ + waitingElement.setBogus(true); + refinedSet.add(waitingElement); + } } } refinedSet.add(SCCelement); - } else if (numCoarse == 1 && (numRead + numWrite + numCoarse == total)) { + } else if (numCoarse == 1 && (numRead + numWrite == total)) { // if one is a coarse, the othere are reads/write, enqueue SCC. WaitingElement we = new WaitingElement(); we.setQueueID(queueID); @@ -659,7 +662,11 @@ public class ConflictGraph { // for rcr, we need to label all of coarse tempdescriptors for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) { WaitingElement waitingElement = (WaitingElement) iterator.next(); - coarseElement.addTempDesc(waitingElement.getTempDesc()); + if(waitingElement!=coarseElement){ + coarseElement.addTempDesc(waitingElement.getTempDesc()); + waitingElement.setBogus(true); + refinedSet.add(waitingElement); + } } } refinedSet.add(coarseElement); diff --git a/Robust/src/Analysis/OoOJava/WaitingElement.java b/Robust/src/Analysis/OoOJava/WaitingElement.java index 0f1b4e54..d4a5b78c 100644 --- a/Robust/src/Analysis/OoOJava/WaitingElement.java +++ b/Robust/src/Analysis/OoOJava/WaitingElement.java @@ -11,6 +11,10 @@ public class WaitingElement { private int status; private String dynID = ""; private TempDescriptor tempDesc; + + // if scc/coarse represents more than one waiting elements + // ignored waiting element is inserted into a set of waiting element as a bogus element + private boolean bogus = false; // a set of tempDescriptors: // all associated with coarse conflicts for the same queue and the same sese @@ -72,7 +76,7 @@ public class WaitingElement { WaitingElement in = (WaitingElement) o; - if (queueID == in.getQueueID() && status == in.getStatus() && dynID.equals(in.getDynID())) { + if (queueID == in.getQueueID() && status == in.getStatus() && dynID.equals(in.getDynID()) && tempDesc.equals(in.getTempDesc())) { return true; } else { return false; @@ -81,7 +85,7 @@ public class WaitingElement { } public String toString() { - return "[waitingID=" + queueID + " status=" + status + " dynID=" + dynID + "]"; + return "[waitingID=" + queueID + " status=" + status + " dynID=" + dynID + " td= "+tempDesc+" isBogus="+ bogus+"]"; } public int hashCode() { @@ -97,5 +101,13 @@ public class WaitingElement { return hash; } + + public boolean isBogus(){ + return bogus; + } + + public void setBogus(boolean b){ + bogus=b; + } } \ No newline at end of file diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index cb507c0b..45bbe904 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -4543,36 +4543,49 @@ public class BuildCode { System.out.println(fm.getMethod()+"["+invars+"]"); Vector queuetovar=new Vector(); - + for(int i=0;i weset=seseWaitingQueue.getWaitingElementSet(td); - int numqueues=weset.size(); - output.println(" seseToIssue->rcrRecords["+i+"].flag="+numqueues+";"); - output.println(" seseToIssue->rcrRecords["+i+"].index=0;"); - output.println(" seseToIssue->rcrRecords["+i+"].next=NULL;"); - output.println(" int dispCount"+i+"=0;"); - - for(Iterator wtit=weset.iterator();wtit.hasNext();) { - Analysis.OoOJava.WaitingElement waitingElement=wtit.next(); - int queueID=waitingElement.getQueueID(); - if (queueID>=queuetovar.size()) - queuetovar.setSize(queueID+1); - Long l=queuetovar.get(queueID); - long val=(l!=null)?l.longValue():0; - val=val|(1< queueSet=new HashSet(); + for (Iterator iterator = weset.iterator(); iterator.hasNext();) { + Analysis.OoOJava.WaitingElement we = (Analysis.OoOJava.WaitingElement) iterator.next(); + Integer queueID=new Integer( we.getQueueID()); + if(!queueSet.contains(queueID)){ + numqueues++; + queueSet.add(queueID); + } + } + output.println(" seseToIssue->rcrRecords["+i+"].flag="+numqueues+";"); + output.println(" seseToIssue->rcrRecords["+i+"].index=0;"); + output.println(" seseToIssue->rcrRecords["+i+"].next=NULL;"); + output.println(" int dispCount"+i+"=0;"); + + for (Iterator wtit = weset.iterator(); wtit.hasNext();) { + Analysis.OoOJava.WaitingElement waitingElement = wtit.next(); + int queueID = waitingElement.getQueueID(); + if (queueID >= queuetovar.size()) + queuetovar.setSize(queueID + 1); + Long l = queuetovar.get(queueID); + long val = (l != null) ? l.longValue() : 0; + val = val | (1 << i); + queuetovar.set(queueID, new Long(val)); + } } HashSet generatedqueueentry=new HashSet(); for(int i=0;i weset=seseWaitingQueue.getWaitingElementSet(td); - int numqueues=weset.size(); for(Iterator wtit=weset.iterator();wtit.hasNext();) { Analysis.OoOJava.WaitingElement waitingElement=wtit.next(); int queueID=waitingElement.getQueueID(); + + if(waitingElement.isBogus()){ + continue; + } + if (generatedqueueentry.contains(queueID)) continue; else