bug fixes for generating empty graph.
authoryeom <yeom>
Fri, 2 Apr 2010 00:37:37 +0000 (00:37 +0000)
committeryeom <yeom>
Fri, 2 Apr 2010 00:37:37 +0000 (00:37 +0000)
Robust/src/Analysis/MLP/ConflictGraph.java
Robust/src/IR/Flat/BuildCode.java

index a7c4c72b9550f4155bb865c93fa135d30d77f21c..2520b8413dad92378bb30fa6911b22104d4a6ac8 100644 (file)
@@ -23,29 +23,18 @@ public class ConflictGraph {
        public ConflictGraph() {
                id2cn = new Hashtable<String, ConflictNode>();
        }
-
-       private boolean isReadOnly(ConflictNode node) {
-
-               if (node instanceof StallSiteNode) {
-                       StallSiteNode stallSiteNode = (StallSiteNode) node;
-                       HashSet<Effect> effectSet = stallSiteNode.getStallSite()
-                                       .getEffectSet();
-                       for (Iterator iterator = effectSet.iterator(); iterator.hasNext();) {
-                               Effect effect = (Effect) iterator.next();
-                               if (effect.getEffectType().equals(StallSite.WRITE_EFFECT)) {
-                                       return false;
-                               }
-                       }
-               } else {
-                       LiveInNode liveInNode = (LiveInNode) node;
-                       Set<SESEEffectsKey> writeEffectSet = liveInNode
-                                       .getWriteEffectsSet();
-                       if (writeEffectSet != null && writeEffectSet.size() > 0) {
-                               return false;
+       
+       public boolean hasConflictEdge(){
+               
+               Set<String> keySet=id2cn.keySet();
+               for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
+                       String key = (String) iterator.next();
+                       ConflictNode node=id2cn.get(key);
+                       if(node.getEdgeSet().size()>0){
+                               return true;
                        }
-               }
-
-               return true;
+               }               
+               return false;
        }
 
        public void analyzeConflicts() {
index 2ec130562114caddc26f63241fcad4c1bdf00843..8832a0bcbb5f13ab85cd3535c67dceefd968d3a8 100644 (file)
@@ -1778,12 +1778,13 @@ public class BuildCode {
       // eom
                ConflictGraph graph = null;
                graph = mlpa.getConflictGraphResults().get(fm);
-               if (graph != null) {
+               if (graph != null && graph.hasConflictEdge()) {
                        output.println("   /* set up waiting queues */");
                        output.println("   int numMemoryQueue=0;");
                        output.println("   int memoryQueueItemID=0;");
                        HashSet<SESELock> lockSet = mlpa.getConflictGraphLockMap().get(
                                        graph);
+                       System.out.println("#lockSet="+lockSet.hashCode());
                        System.out.println("lockset="+lockSet);
                        for (Iterator iterator = lockSet.iterator(); iterator.hasNext();) {
                                SESELock seseLock = (SESELock) iterator.next();
@@ -2084,12 +2085,13 @@ public class BuildCode {
        output.println("   int memoryQueueItemID=0;");
        ConflictGraph graph = null;
        graph = mlpa.getConflictGraphResults().get(fsen);
-       if (graph != null) {
+       if (graph != null && graph.hasConflictEdge()) {
                output.println("   {");
                output
                                .println("   SESEcommon* parentCommon = &(___params___->common);");
                HashSet<SESELock> lockSet = mlpa.getConflictGraphLockMap().get(
                                graph);
+               System.out.println("#lockSet="+lockSet);
 
                if (lockSet.size() > 0) {
                        output.println("   numMemoryQueue=" + lockSet.size() + ";");
@@ -3369,7 +3371,7 @@ public class BuildCode {
                        graph = mlpa.getConflictGraphResults().get(parent);
                }
        }
-       if (graph != null) {
+       if (graph != null && graph.hasConflictEdge()) {
                HashSet<SESELock> seseLockSet = mlpa.getConflictGraphLockMap().get(
                                graph);
                output.println();