interface to grab the conflict effect set for Stephen,
authoryeom <yeom>
Fri, 6 Aug 2010 18:29:53 +0000 (18:29 +0000)
committeryeom <yeom>
Fri, 6 Aug 2010 18:29:53 +0000 (18:29 +0000)
Robust/src/Analysis/OoOJava/ConflictGraph.java
Robust/src/Analysis/OoOJava/ConflictNode.java
Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java
Robust/src/IR/Flat/BuildCode.java

index 2db90da1347cdd4d37403940050897ba1088479c..8a873f313b4282640471beac48d1d44865cc152f 100644 (file)
@@ -24,6 +24,7 @@ import IR.Flat.TempDescriptor;
 public class ConflictGraph {
 
   protected Hashtable<String, ConflictNode> id2cn;
 public class ConflictGraph {
 
   protected Hashtable<String, ConflictNode> id2cn;
+  protected Hashtable<FlatSESEEnterNode, Hashtable<Taint, Set<Effect>>> sese2te;
 
   protected DisjointAnalysis da;
   protected FlatMethod fmEnclosing;
 
   protected DisjointAnalysis da;
   protected FlatMethod fmEnclosing;
@@ -35,6 +36,7 @@ public class ConflictGraph {
 
   public ConflictGraph() {
     id2cn = new Hashtable<String, ConflictNode>();
 
   public ConflictGraph() {
     id2cn = new Hashtable<String, ConflictNode>();
+    sese2te = new Hashtable<FlatSESEEnterNode, Hashtable<Taint, Set<Effect>>>();
   }
 
   public void setDisJointAnalysis(DisjointAnalysis da) {
   }
 
   public void setDisJointAnalysis(DisjointAnalysis da) {
@@ -101,6 +103,7 @@ public class ConflictGraph {
   }
 
   public void addLiveInNodeEffect(Taint t, Effect e) {
   }
 
   public void addLiveInNodeEffect(Taint t, Effect e) {
+
     FlatSESEEnterNode sese = t.getSESE();
     TempDescriptor invar = t.getVar();
     AllocSite as = t.getAllocSite();
     FlatSESEEnterNode sese = t.getSESE();
     TempDescriptor invar = t.getVar();
     AllocSite as = t.getAllocSite();
@@ -111,6 +114,7 @@ public class ConflictGraph {
       node = new ConflictNode(id, ConflictNode.INVAR, t.getVar(), t.getSESE());
     }
     node.addEffect(as, e);
       node = new ConflictNode(id, ConflictNode.INVAR, t.getVar(), t.getSESE());
     }
     node.addEffect(as, e);
+    node.addTaint(t);
 
     id2cn.put(id, node);
   }
 
     id2cn.put(id, node);
   }
@@ -184,21 +188,21 @@ public class ConflictGraph {
 
       String entryNodeID = entry.getKey();
       ConflictNode entryNode = entry.getValue();
 
       String entryNodeID = entry.getKey();
       ConflictNode entryNode = entry.getValue();
-      
-      if(currentNode.isStallSiteNode() && entryNode.isStallSiteNode()){
+
+      if (currentNode.isStallSiteNode() && entryNode.isStallSiteNode()) {
         continue;
       }
         continue;
       }
-      
-      if( (currentNode.isInVarNode() && entryNode.isInVarNode()) && 
-          (currentNode.getSESEIdentifier()==entryNode.getSESEIdentifier()) &&
-          (currentNode.getVar().equals(entryNode.getVar())) ){
+
+      if ((currentNode.isInVarNode() && entryNode.isInVarNode())
+          && (currentNode.getSESEIdentifier() == entryNode.getSESEIdentifier())
+          && (currentNode.getVar().equals(entryNode.getVar()))) {
         continue;
       }
 
       if ((!currentNode.getID().equals(entryNodeID))
           && !(analyzedIDSet.contains(currentNode.getID() + entryNodeID) || analyzedIDSet
               .contains(entryNodeID + currentNode.getID()))) {
         continue;
       }
 
       if ((!currentNode.getID().equals(entryNodeID))
           && !(analyzedIDSet.contains(currentNode.getID() + entryNodeID) || analyzedIDSet
               .contains(entryNodeID + currentNode.getID()))) {
-        
+
         conflictType = calculateConflictType(currentNode, entryNode, useReachInfo);
         if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) {
           addConflictEdge(conflictType, currentNode, entryNode);
         conflictType = calculateConflictType(currentNode, entryNode, useReachInfo);
         if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) {
           addConflictEdge(conflictType, currentNode, entryNode);
@@ -222,11 +226,11 @@ public class ConflictGraph {
     Hashtable<AllocSite, Set<Effect>> alloc2SUEffects = node.getStrongUpdateEffectSet();
 
     conflictType =
     Hashtable<AllocSite, Set<Effect>> alloc2SUEffects = node.getStrongUpdateEffectSet();
 
     conflictType =
-        updateConflictType(conflictType, determineConflictType(alloc2writeEffects,
+        updateConflictType(conflictType, determineConflictType(node, alloc2writeEffects, node,
             alloc2writeEffects, useReachInfo));
 
     conflictType =
             alloc2writeEffects, useReachInfo));
 
     conflictType =
-        updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffects,
+        updateConflictType(conflictType, hasStrongUpdateConflicts(node, alloc2SUEffects, node,
             alloc2readEffects, alloc2writeEffects, useReachInfo));
 
     return conflictType;
             alloc2readEffects, alloc2writeEffects, useReachInfo));
 
     return conflictType;
@@ -245,15 +249,15 @@ public class ConflictGraph {
 
     // if node A has write effects on reading/writing regions of node B
     conflictType =
 
     // if node A has write effects on reading/writing regions of node B
     conflictType =
-        updateConflictType(conflictType, determineConflictType(alloc2writeEffectsA,
+        updateConflictType(conflictType, determineConflictType(nodeA, alloc2writeEffectsA, nodeB,
             alloc2readEffectsB, useReachInfo));
     conflictType =
             alloc2readEffectsB, useReachInfo));
     conflictType =
-        updateConflictType(conflictType, determineConflictType(alloc2writeEffectsA,
+        updateConflictType(conflictType, determineConflictType(nodeA, alloc2writeEffectsA, nodeB,
             alloc2writeEffectsB, useReachInfo));
 
     // if node B has write effects on reading regions of node A
     conflictType =
             alloc2writeEffectsB, useReachInfo));
 
     // if node B has write effects on reading regions of node A
     conflictType =
-        updateConflictType(conflictType, determineConflictType(alloc2writeEffectsB,
+        updateConflictType(conflictType, determineConflictType(nodeB, alloc2writeEffectsB, nodeA,
             alloc2readEffectsA, useReachInfo));
 
     // strong udpate effects conflict with all effects
             alloc2readEffectsA, useReachInfo));
 
     // strong udpate effects conflict with all effects
@@ -261,21 +265,22 @@ public class ConflictGraph {
     // if node A has SU on regions of node B
     if (!alloc2SUEffectsA.isEmpty()) {
       conflictType =
     // if node A has SU on regions of node B
     if (!alloc2SUEffectsA.isEmpty()) {
       conflictType =
-          updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffectsA,
+          updateConflictType(conflictType, hasStrongUpdateConflicts(nodeA, alloc2SUEffectsA, nodeB,
               alloc2readEffectsB, alloc2writeEffectsB, useReachInfo));
     }
 
     // if node B has SU on regions of node A
     if (!alloc2SUEffectsB.isEmpty()) {
       conflictType =
               alloc2readEffectsB, alloc2writeEffectsB, useReachInfo));
     }
 
     // if node B has SU on regions of node A
     if (!alloc2SUEffectsB.isEmpty()) {
       conflictType =
-          updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffectsB,
+          updateConflictType(conflictType, hasStrongUpdateConflicts(nodeB, alloc2SUEffectsB, nodeA,
               alloc2readEffectsA, alloc2writeEffectsA, useReachInfo));
     }
 
     return conflictType;
   }
 
               alloc2readEffectsA, alloc2writeEffectsA, useReachInfo));
     }
 
     return conflictType;
   }
 
-  private int hasStrongUpdateConflicts(Hashtable<AllocSite, Set<Effect>> SUEffectsTableA,
+  private int hasStrongUpdateConflicts(ConflictNode nodeA,
+      Hashtable<AllocSite, Set<Effect>> SUEffectsTableA, ConflictNode nodeB,
       Hashtable<AllocSite, Set<Effect>> readTableB, Hashtable<AllocSite, Set<Effect>> writeTableB,
       boolean useReachInfo) {
 
       Hashtable<AllocSite, Set<Effect>> readTableB, Hashtable<AllocSite, Set<Effect>> writeTableB,
       boolean useReachInfo) {
 
@@ -305,6 +310,10 @@ public class ConflictGraph {
                 FlatNew fnRoot2 = asB.getFlatNew();
                 FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew();
                 if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
                 FlatNew fnRoot2 = asB.getFlatNew();
                 FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew();
                 if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
+                  addCoarseEffect(nodeA, asA, strongUpdateA);
+                  if (!nodeA.equals(nodeB)) {
+                    addCoarseEffect(nodeB, asB, effectB);
+                  }
                   conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                 }
               } else {
                   conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                 }
               } else {
@@ -336,9 +345,13 @@ public class ConflictGraph {
                 FlatNew fnRoot2 = asB.getFlatNew();
                 FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew();
                 if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
                 FlatNew fnRoot2 = asB.getFlatNew();
                 FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew();
                 if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
+                  addCoarseEffect(nodeA, asA, strongUpdateA);
+                  if (!nodeA.equals(nodeB)) {
+                    addCoarseEffect(nodeB, asB, effectB);
+                  }
                   conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                 }
                   conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                 }
-              }else{
+              } else {
                 return ConflictGraph.CONFLICT;
               }
             }
                 return ConflictGraph.CONFLICT;
               }
             }
@@ -353,7 +366,8 @@ public class ConflictGraph {
 
   }
 
 
   }
 
-  private int determineConflictType(Hashtable<AllocSite, Set<Effect>> nodeAtable,
+  private int determineConflictType(ConflictNode nodeA,
+      Hashtable<AllocSite, Set<Effect>> nodeAtable, ConflictNode nodeB,
       Hashtable<AllocSite, Set<Effect>> nodeBtable, boolean useReachInfo) {
 
     int conflictType = ConflictGraph.NON_WRITE_CONFLICT;
       Hashtable<AllocSite, Set<Effect>> nodeBtable, boolean useReachInfo) {
 
     int conflictType = ConflictGraph.NON_WRITE_CONFLICT;
@@ -385,16 +399,24 @@ public class ConflictGraph {
                 if (fnRoot1.equals(fnRoot2)) {
                   if (!da.mayManyReachTarget(fmEnclosing, fnRoot1, fnTarget)) {
                     // fine-grained conflict case
                 if (fnRoot1.equals(fnRoot2)) {
                   if (!da.mayManyReachTarget(fmEnclosing, fnRoot1, fnTarget)) {
                     // fine-grained conflict case
-                    conflictType =
-                      updateConflictType(conflictType, ConflictGraph.FINE_GRAIN_EDGE);
+                    conflictType = updateConflictType(conflictType, ConflictGraph.FINE_GRAIN_EDGE);
                   } else {
                   } else {
+                    // coarse-grained conflict case
+                    addCoarseEffect(nodeA, asA, effectA);
+                    if (!nodeA.equals(nodeB)) {
+                      addCoarseEffect(nodeB, asB, effectB);
+                    }
                     conflictType =
                     conflictType =
-                      updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
+                        updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                   }
                 } else {
                   if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
                   }
                 } else {
                   if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) {
+                    addCoarseEffect(nodeA, asA, effectA);
+                    if (!nodeA.equals(nodeB)) {
+                      addCoarseEffect(nodeB, asB, effectB);
+                    }
                     conflictType =
                     conflictType =
-                      updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
+                        updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE);
                   } else {
                   }
                 }
                   } else {
                   }
                 }
@@ -410,6 +432,29 @@ public class ConflictGraph {
     return conflictType;
   }
 
     return conflictType;
   }
 
+  private void addCoarseEffect(ConflictNode node, AllocSite as, Effect e) {
+    Taint t = node.getTaint(as);
+    addEffectSetByTaint(t, e);
+  }
+
+  private void addEffectSetByTaint(Taint t, Effect e) {
+
+    Hashtable<Taint, Set<Effect>> taint2Conflicts = sese2te.get(t.getSESE());
+    if (taint2Conflicts == null) {
+      taint2Conflicts = new Hashtable<Taint, Set<Effect>>();
+    }
+
+    Set<Effect> effectSet = taint2Conflicts.get(t);
+    if (effectSet == null) {
+      effectSet = new HashSet<Effect>();
+    }
+    effectSet.add(e);
+    taint2Conflicts.put(t, effectSet);
+
+    sese2te.put(t.getSESE(), taint2Conflicts);
+
+  }
+
   private int updateConflictType(int current, int newType) {
     if (newType > current) {
       return newType;
   private int updateConflictType(int current, int newType) {
     if (newType > current) {
       return newType;
@@ -461,9 +506,8 @@ public class ConflictGraph {
     }
   }
 
     }
   }
 
-  public SESEWaitingQueue getWaitingElementSetBySESEID(int seseID,
- Set<SESELock> seseLockSet) {
-    
+  public SESEWaitingQueue getWaitingElementSetBySESEID(int seseID, Set<SESELock> seseLockSet) {
+
     HashSet<WaitingElement> waitingElementSet = new HashSet<WaitingElement>();
 
     Iterator iter = id2cn.entrySet().iterator();
     HashSet<WaitingElement> waitingElementSet = new HashSet<WaitingElement>();
 
     Iterator iter = id2cn.entrySet().iterator();
@@ -506,56 +550,52 @@ public class ConflictGraph {
     // handle the case that multiple enqueues by an SESE for different live-in
     // into the same queue
     return refineQueue(waitingElementSet);
     // handle the case that multiple enqueues by an SESE for different live-in
     // into the same queue
     return refineQueue(waitingElementSet);
-//    return waitingElementSet;
+    // return waitingElementSet;
 
   }
 
   }
-  
+
   public SESEWaitingQueue refineQueue(Set<WaitingElement> waitingElementSet) {
 
   public SESEWaitingQueue refineQueue(Set<WaitingElement> waitingElementSet) {
 
-    Set<WaitingElement> refinedSet=new HashSet<WaitingElement>();
+    Set<WaitingElement> refinedSet = new HashSet<WaitingElement>();
     HashMap<Integer, Set<WaitingElement>> map = new HashMap<Integer, Set<WaitingElement>>();
     HashMap<Integer, Set<WaitingElement>> map = new HashMap<Integer, Set<WaitingElement>>();
-    SESEWaitingQueue seseDS=new SESEWaitingQueue();
+    SESEWaitingQueue seseDS = new SESEWaitingQueue();
 
 
-    for (Iterator iterator = waitingElementSet.iterator(); iterator
-        .hasNext();) {
+    for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
       WaitingElement waitingElement = (WaitingElement) iterator.next();
       WaitingElement waitingElement = (WaitingElement) iterator.next();
-      Set<WaitingElement> set=map.get(new Integer(waitingElement.getQueueID()));
-      if(set==null){
-        set=new HashSet<WaitingElement>();
+      Set<WaitingElement> set = map.get(new Integer(waitingElement.getQueueID()));
+      if (set == null) {
+        set = new HashSet<WaitingElement>();
       }
       set.add(waitingElement);
       map.put(new Integer(waitingElement.getQueueID()), set);
     }
       }
       set.add(waitingElement);
       map.put(new Integer(waitingElement.getQueueID()), set);
     }
-    
-    Set<Integer> keySet=map.keySet();
+
+    Set<Integer> keySet = map.keySet();
     for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
       Integer queueID = (Integer) iterator.next();
     for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
       Integer queueID = (Integer) iterator.next();
-      Set<WaitingElement> queueWEset=map.get(queueID);
-      refineQueue(queueID.intValue(),queueWEset,seseDS);      
+      Set<WaitingElement> queueWEset = map.get(queueID);
+      refineQueue(queueID.intValue(), queueWEset, seseDS);
     }
     }
-    
+
     return seseDS;
   }
     return seseDS;
   }
-  
-  
-  private void refineQueue(int queueID,
-      Set<WaitingElement> waitingElementSet, SESEWaitingQueue seseDS) {
+
+  private void refineQueue(int queueID, Set<WaitingElement> waitingElementSet,
+      SESEWaitingQueue seseDS) {
 
     if (waitingElementSet.size() > 1) {
 
     if (waitingElementSet.size() > 1) {
-      //only consider there is more than one element submitted by same SESE
+      // only consider there is more than one element submitted by same SESE
       Set<WaitingElement> refinedSet = new HashSet<WaitingElement>();
 
       int numCoarse = 0;
       int numRead = 0;
       int numWrite = 0;
       Set<WaitingElement> refinedSet = new HashSet<WaitingElement>();
 
       int numCoarse = 0;
       int numRead = 0;
       int numWrite = 0;
-      int total=waitingElementSet.size();
+      int total = waitingElementSet.size();
       WaitingElement SCCelement = null;
       WaitingElement coarseElement = null;
 
       WaitingElement SCCelement = null;
       WaitingElement coarseElement = null;
 
-      for (Iterator iterator = waitingElementSet.iterator(); iterator
-          .hasNext();) {
-        WaitingElement waitingElement = (WaitingElement) iterator
-            .next();
+      for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
+        WaitingElement waitingElement = (WaitingElement) iterator.next();
         if (waitingElement.getStatus() == ConflictNode.FINE_READ) {
           numRead++;
         } else if (waitingElement.getStatus() == ConflictNode.FINE_WRITE) {
         if (waitingElement.getStatus() == ConflictNode.FINE_READ) {
           numRead++;
         } else if (waitingElement.getStatus() == ConflictNode.FINE_WRITE) {
@@ -565,7 +605,7 @@ public class ConflictGraph {
           coarseElement = waitingElement;
         } else if (waitingElement.getStatus() == ConflictNode.SCC) {
           SCCelement = waitingElement;
           coarseElement = waitingElement;
         } else if (waitingElement.getStatus() == ConflictNode.SCC) {
           SCCelement = waitingElement;
-        } 
+        }
       }
 
       if (SCCelement != null) {
       }
 
       if (SCCelement != null) {
@@ -581,11 +621,12 @@ public class ConflictGraph {
       } else if (numCoarse == total) {
         // if there are multiple coarses, enqueue just one coarse.
         refinedSet.add(coarseElement);
       } else if (numCoarse == total) {
         // if there are multiple coarses, enqueue just one coarse.
         refinedSet.add(coarseElement);
-      } else if(numWrite==total || (numRead+numWrite)==total){
-        // code generator is going to handle the case for multiple writes & read/writes.
+      } else if (numWrite == total || (numRead + numWrite) == total) {
+        // code generator is going to handle the case for multiple writes &
+        // read/writes.
         seseDS.setType(queueID, SESEWaitingQueue.EXCEPTION);
         refinedSet.addAll(waitingElementSet);
         seseDS.setType(queueID, SESEWaitingQueue.EXCEPTION);
         refinedSet.addAll(waitingElementSet);
-      } else{
+      } else {
         // otherwise, enqueue everything.
         refinedSet.addAll(waitingElementSet);
       }
         // otherwise, enqueue everything.
         refinedSet.addAll(waitingElementSet);
       }
@@ -593,9 +634,9 @@ public class ConflictGraph {
     } else {
       seseDS.setWaitingElementSet(queueID, waitingElementSet);
     }
     } else {
       seseDS.setWaitingElementSet(queueID, waitingElementSet);
     }
-    
+
   }
   }
-  
+
   public Set<WaitingElement> getStallSiteWaitingElementSet(FlatNode stallSite,
       Set<SESELock> seseLockSet) {
 
   public Set<WaitingElement> getStallSiteWaitingElementSet(FlatNode stallSite,
       Set<SESELock> seseLockSet) {
 
@@ -634,6 +675,10 @@ public class ConflictGraph {
     return waitingElementSet;
   }
 
     return waitingElementSet;
   }
 
+  public Hashtable<Taint, Set<Effect>> getConflictEffectSet(FlatSESEEnterNode fsen) {
+    return sese2te.get(fsen);
+  }
+
   public void writeGraph(String graphName, boolean filter) throws java.io.IOException {
 
     graphName = graphName.replaceAll("[\\W]", "");
   public void writeGraph(String graphName, boolean filter) throws java.io.IOException {
 
     graphName = graphName.replaceAll("[\\W]", "");
@@ -657,11 +702,11 @@ public class ConflictGraph {
 
           continue;
         }
 
           continue;
         }
-        
-        if(node.getEdgeSet().isEmpty()){
+
+        if (node.getEdgeSet().isEmpty()) {
           continue;
         }
           continue;
         }
-        
+
       }
 
       String attributes = "[";
       }
 
       String attributes = "[";
index 6933863584c22c4665925c6290ef055662ebcda6..c0f14a83dfe2efcb9ca669cf881b65e03913ca09 100644 (file)
@@ -7,6 +7,7 @@ import java.util.Set;
 
 import Analysis.Disjoint.AllocSite;
 import Analysis.Disjoint.Effect;
 
 import Analysis.Disjoint.AllocSite;
 import Analysis.Disjoint.Effect;
+import Analysis.Disjoint.Taint;
 import IR.Flat.FlatNew;
 import IR.Flat.FlatNode;
 import IR.Flat.FlatSESEEnterNode;
 import IR.Flat.FlatNew;
 import IR.Flat.FlatNode;
 import IR.Flat.FlatSESEEnterNode;
@@ -16,6 +17,7 @@ public class ConflictNode {
 
   protected HashSet<ConflictEdge> edgeSet;
   protected HashSet<AllocSite> allocSet;
 
   protected HashSet<ConflictEdge> edgeSet;
   protected HashSet<AllocSite> allocSet;
+  protected HashSet<Taint> taintSet;
 
   protected Hashtable<AllocSite, Set<Effect>> alloc2readEffectSet;
   protected Hashtable<AllocSite, Set<Effect>> alloc2writeEffectSet;
 
   protected Hashtable<AllocSite, Set<Effect>> alloc2readEffectSet;
   protected Hashtable<AllocSite, Set<Effect>> alloc2writeEffectSet;
@@ -37,23 +39,23 @@ public class ConflictNode {
 
   public static final int INVAR = 0;
   public static final int STALLSITE = 1;
 
   public static final int INVAR = 0;
   public static final int STALLSITE = 1;
-  
-  public ConflictNode(String id, int nodeType, TempDescriptor var, FlatNode stallSite){
+
+  public ConflictNode(String id, int nodeType, TempDescriptor var, FlatNode stallSite) {
     this(id, var, nodeType);
     this(id, var, nodeType);
-    this.stallSite=stallSite;    
+    this.stallSite = stallSite;
   }
   }
-  
-  public ConflictNode(String id, int nodeType, TempDescriptor var, FlatSESEEnterNode fsen){
+
+  public ConflictNode(String id, int nodeType, TempDescriptor var, FlatSESEEnterNode fsen) {
     this(id, var, nodeType);
     this(id, var, nodeType);
-    this.fsen=fsen;    
+    this.fsen = fsen;
   }
 
   }
 
-
   public ConflictNode(String id, TempDescriptor var, int nodeType) {
     edgeSet = new HashSet<ConflictEdge>();
   public ConflictNode(String id, TempDescriptor var, int nodeType) {
     edgeSet = new HashSet<ConflictEdge>();
-    // redundant views of access root's 
+    // redundant views of access root's
     // allocation sites for efficient retrieval
     allocSet = new HashSet<AllocSite>();
     // allocation sites for efficient retrieval
     allocSet = new HashSet<AllocSite>();
+    taintSet = new HashSet<Taint>();
 
     alloc2readEffectSet = new Hashtable<AllocSite, Set<Effect>>();
     alloc2writeEffectSet = new Hashtable<AllocSite, Set<Effect>>();
 
     alloc2readEffectSet = new Hashtable<AllocSite, Set<Effect>>();
     alloc2writeEffectSet = new Hashtable<AllocSite, Set<Effect>>();
@@ -61,7 +63,21 @@ public class ConflictNode {
 
     this.id = id;
     this.nodeType = nodeType;
 
     this.id = id;
     this.nodeType = nodeType;
-    this.var=var;
+    this.var = var;
+  }
+
+  public void addTaint(Taint t) {
+    taintSet.add(t);
+  }
+
+  public Taint getTaint(AllocSite as) {
+    for (Iterator iterator = taintSet.iterator(); iterator.hasNext();) {
+      Taint t = (Taint) iterator.next();
+      if (t.getAllocSite().equals(as)) {
+        return t;
+      }
+    }
+    return null;
   }
 
   public void addEffect(AllocSite as, Effect e) {
   }
 
   public void addEffect(AllocSite as, Effect e) {
@@ -75,7 +91,7 @@ public class ConflictNode {
   }
 
   public void addReadEffect(AllocSite as, Effect e) {
   }
 
   public void addReadEffect(AllocSite as, Effect e) {
-    allocSet.add(as);    
+    allocSet.add(as);
     Set<Effect> effectSet = alloc2readEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
     Set<Effect> effectSet = alloc2readEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
@@ -86,7 +102,7 @@ public class ConflictNode {
   }
 
   public void addWriteEffect(AllocSite as, Effect e) {
   }
 
   public void addWriteEffect(AllocSite as, Effect e) {
-    allocSet.add(as);    
+    allocSet.add(as);
     Set<Effect> effectSet = alloc2writeEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
     Set<Effect> effectSet = alloc2writeEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
@@ -97,7 +113,7 @@ public class ConflictNode {
   }
 
   public void addStrongUpdateEffect(AllocSite as, Effect e) {
   }
 
   public void addStrongUpdateEffect(AllocSite as, Effect e) {
-    allocSet.add(as);    
+    allocSet.add(as);
     Set<Effect> effectSet = alloc2strongUpdateEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
     Set<Effect> effectSet = alloc2strongUpdateEffectSet.get(as);
     if (effectSet == null) {
       effectSet = new HashSet<Effect>();
@@ -129,18 +145,18 @@ public class ConflictNode {
   public boolean isStallSiteNode() {
     return !isInVarNode();
   }
   public boolean isStallSiteNode() {
     return !isInVarNode();
   }
-  
-  public Set<FlatNew> getFlatNewSet(){
-    Set<FlatNew> fnSet=new HashSet<FlatNew>();
+
+  public Set<FlatNew> getFlatNewSet() {
+    Set<FlatNew> fnSet = new HashSet<FlatNew>();
     for (Iterator iterator = allocSet.iterator(); iterator.hasNext();) {
       AllocSite as = (AllocSite) iterator.next();
     for (Iterator iterator = allocSet.iterator(); iterator.hasNext();) {
       AllocSite as = (AllocSite) iterator.next();
-      FlatNew fn=as.getFlatNew();
+      FlatNew fn = as.getFlatNew();
       fnSet.add(fn);
     }
     return fnSet;
   }
       fnSet.add(fn);
     }
     return fnSet;
   }
-  
-  public TempDescriptor getVar(){
+
+  public TempDescriptor getVar() {
     return var;
   }
 
     return var;
   }
 
@@ -155,15 +171,15 @@ public class ConflictNode {
   public String getID() {
     return id;
   }
   public String getID() {
     return id;
   }
-  
-  public FlatNode getStallSiteFlatNode(){
+
+  public FlatNode getStallSiteFlatNode() {
     return stallSite;
   }
     return stallSite;
   }
-  
-  public int getSESEIdentifier(){
+
+  public int getSESEIdentifier() {
     return fsen.getIdentifier();
   }
     return fsen.getIdentifier();
   }
-  
+
   public boolean equals(Object o) {
 
     if (o == null) {
   public boolean equals(Object o) {
 
     if (o == null) {
@@ -202,9 +218,9 @@ public class ConflictNode {
 
     return str;
   }
 
     return str;
   }
-  
-  public String toString(){
+
+  public String toString() {
     return id;
   }
     return id;
   }
-  
+
 }
 }
index aa0db186d5dd2c7ac2be3db21d2da8161545ad40..a6065eabd46cb75e859b41357ffc0c4c2ec43c4e 100644 (file)
@@ -66,8 +66,8 @@ public class OoOJavaAnalysis {
 
   private Hashtable<FlatEdge, FlatWriteDynamicVarNode> wdvNodesToSpliceIn;
 
 
   private Hashtable<FlatEdge, FlatWriteDynamicVarNode> wdvNodesToSpliceIn;
 
-  // temporal data structures to track analysis progress. 
-  static private int uniqueLockSetId = 0;  
+  // temporal data structures to track analysis progress.
+  static private int uniqueLockSetId = 0;
   // mapping of a conflict graph to its compiled lock
   private Hashtable<ConflictGraph, HashSet<SESELock>> conflictGraph2SESELock;
   // mapping of a sese block to its conflict graph
   // mapping of a conflict graph to its compiled lock
   private Hashtable<ConflictGraph, HashSet<SESELock>> conflictGraph2SESELock;
   // mapping of a sese block to its conflict graph
@@ -116,12 +116,10 @@ public class OoOJavaAnalysis {
 
     descriptorsToAnalyze.add(mdSourceEntry);
 
 
     descriptorsToAnalyze.add(mdSourceEntry);
 
-    
     // 1st pass, find basic rblock relations & status
     rblockRel = new RBlockRelationAnalysis(state, typeUtil, callGraph);
     rblockStatus = new RBlockStatusAnalysis(state, typeUtil, callGraph, rblockRel);
 
     // 1st pass, find basic rblock relations & status
     rblockRel = new RBlockRelationAnalysis(state, typeUtil, callGraph);
     rblockStatus = new RBlockStatusAnalysis(state, typeUtil, callGraph, rblockRel);
 
-
     // 2nd pass, liveness, in-set out-set (no virtual reads yet!)
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
     while (rootItr.hasNext()) {
     // 2nd pass, liveness, in-set out-set (no virtual reads yet!)
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
     while (rootItr.hasNext()) {
@@ -150,17 +148,14 @@ public class OoOJavaAnalysis {
 
     // 5th pass, use disjointness with NO FLAGGED REGIONS
     // to compute taints and effects
 
     // 5th pass, use disjointness with NO FLAGGED REGIONS
     // to compute taints and effects
-    disjointAnalysisTaints = 
-      new DisjointAnalysis(state, 
-                           typeUtil, 
-                           callGraph, 
-                           liveness,
-                           arrayReferencees, 
-                           null, // no FlatNew set to flag
-                           rblockRel, 
-                           rblockStatus
-                           );
-    
+    disjointAnalysisTaints =
+        new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, null, // no
+                                                                                           // FlatNew
+                                                                                           // set
+                                                                                           // to
+                                                                                           // flag
+            rblockRel, rblockStatus);
+
     // 6th pass, not available analysis FOR VARIABLES!
     methItr = descriptorsToAnalyze.iterator();
     while (methItr.hasNext()) {
     // 6th pass, not available analysis FOR VARIABLES!
     methItr = descriptorsToAnalyze.iterator();
     while (methItr.hasNext()) {
@@ -171,104 +166,97 @@ public class OoOJavaAnalysis {
       // point, in a forward fixed-point pass
       notAvailableForward(fm);
     }
       // point, in a forward fixed-point pass
       notAvailableForward(fm);
     }
-    
-    // 7th pass,  make conflict graph
+
+    // 7th pass, make conflict graph
     // conflict graph is maintained by each parent sese,
     // conflict graph is maintained by each parent sese,
-    Iterator descItr=disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
+    Iterator descItr = disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
     while (descItr.hasNext()) {
     while (descItr.hasNext()) {
-      Descriptor d = (Descriptor)descItr.next();
+      Descriptor d = (Descriptor) descItr.next();
       FlatMethod fm = state.getMethodFlat(d);
       FlatMethod fm = state.getMethodFlat(d);
-      if(fm != null)
+      if (fm != null)
         makeConflictGraph(fm);
     }
 
         makeConflictGraph(fm);
     }
 
-    // debug routine 
+    // debug routine
     /*
     /*
-    Iterator iter = sese2conflictGraph.entrySet().iterator();
-    while (iter.hasNext()) {
-      Entry e = (Entry) iter.next();
-      FlatNode fn = (FlatNode) e.getKey();
-      ConflictGraph conflictGraph = (ConflictGraph) e.getValue();
-      System.out.println("---------------------------------------");
-      System.out.println("CONFLICT GRAPH for " + fn);
-      Set<String> keySet = conflictGraph.id2cn.keySet();
-      for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
-        String key = (String) iterator.next();
-        ConflictNode node = conflictGraph.id2cn.get(key);
-        System.out.println("key=" + key + " \n" + node.toStringAllEffects());
-      }
-    }
-    */
-    
-    // 8th pass, calculate all possible conflicts without using reachability info
-    // and identify set of FlatNew that next disjoint reach. analysis should flag
+     * Iterator iter = sese2conflictGraph.entrySet().iterator(); while
+     * (iter.hasNext()) { Entry e = (Entry) iter.next(); FlatNode fn =
+     * (FlatNode) e.getKey(); ConflictGraph conflictGraph = (ConflictGraph)
+     * e.getValue();
+     * System.out.println("---------------------------------------");
+     * System.out.println("CONFLICT GRAPH for " + fn); Set<String> keySet =
+     * conflictGraph.id2cn.keySet(); for (Iterator iterator = keySet.iterator();
+     * iterator.hasNext();) { String key = (String) iterator.next();
+     * ConflictNode node = conflictGraph.id2cn.get(key);
+     * System.out.println("key=" + key + " \n" + node.toStringAllEffects()); } }
+     */
+
+    // 8th pass, calculate all possible conflicts without using reachability
+    // info
+    // and identify set of FlatNew that next disjoint reach. analysis should
+    // flag
     Set<FlatNew> sitesToFlag = new HashSet<FlatNew>();
     Set<FlatNew> sitesToFlag = new HashSet<FlatNew>();
-    calculateConflicts(sitesToFlag,false);    
-    
+    calculateConflicts(sitesToFlag, false);
+
     // 9th pass, ask disjoint analysis to compute reachability
     // for objects that may cause heap conflicts so the most
     // efficient method to deal with conflict can be computed
     // later
     // 9th pass, ask disjoint analysis to compute reachability
     // for objects that may cause heap conflicts so the most
     // efficient method to deal with conflict can be computed
     // later
-   
-    disjointAnalysisReach = 
-      new DisjointAnalysis(state, 
-                           typeUtil, 
-                           callGraph, 
-                           liveness,
-                           arrayReferencees, 
-                           sitesToFlag,
-                           null, // don't do effects analysis again!
-                           null  // don't do effects analysis again!
-                           );
+
+    disjointAnalysisReach =
+        new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, sitesToFlag,
+            null, // don't do effects analysis again!
+            null // don't do effects analysis again!
+        );
     // 10th pass, calculate conflicts with reachability info
     // 10th pass, calculate conflicts with reachability info
-    calculateConflicts(null, true);    
-   
+    calculateConflicts(null, true);
+
     // 11th pass, compiling locks
     synthesizeLocks();
     // 11th pass, compiling locks
     synthesizeLocks();
-    
+
     // 12th pass, compute a plan for code injections
     // 12th pass, compute a plan for code injections
-    methItr =descriptorsToAnalyze.iterator();
-    while( methItr.hasNext() ) {
-      Descriptor d  = methItr.next();      
-      FlatMethod fm = state.getMethodFlat( d );
-      codePlansForward( fm );
+    methItr = descriptorsToAnalyze.iterator();
+    while (methItr.hasNext()) {
+      Descriptor d = methItr.next();
+      FlatMethod fm = state.getMethodFlat(d);
+      codePlansForward(fm);
     }
     }
-    
+
     // 13th pass,
     // splice new IR nodes into graph after all
     // analysis passes are complete
     Iterator spliceItr = wdvNodesToSpliceIn.entrySet().iterator();
     // 13th pass,
     // splice new IR nodes into graph after all
     // analysis passes are complete
     Iterator spliceItr = wdvNodesToSpliceIn.entrySet().iterator();
-    while( spliceItr.hasNext() ) {
-      Map.Entry               me    = (Map.Entry)               spliceItr.next();
+    while (spliceItr.hasNext()) {
+      Map.Entry me = (Map.Entry) spliceItr.next();
       FlatWriteDynamicVarNode fwdvn = (FlatWriteDynamicVarNode) me.getValue();
       fwdvn.spliceIntoIR();
     }
       FlatWriteDynamicVarNode fwdvn = (FlatWriteDynamicVarNode) me.getValue();
       fwdvn.spliceIntoIR();
     }
-    
-    
-    if( state.OOODEBUG ) {      
+
+    if (state.OOODEBUG) {
       try {
       try {
-        writeReports( "" );
-        disjointAnalysisTaints.getEffectsAnalysis().writeEffects( "effects.txt" );
+        writeReports("");
+        disjointAnalysisTaints.getEffectsAnalysis().writeEffects("effects.txt");
         writeConflictGraph();
         writeConflictGraph();
-      } catch( IOException e ) {}
+      } catch (IOException e) {
+      }
     }
     }
-    
+
   }
   }
-  
-  private void writeFile(Set<FlatNew> sitesToFlag){
-    
-    try{
-    BufferedWriter bw = new BufferedWriter( new FileWriter( "sitesToFlag.txt" ) );
-    
-    for (Iterator iterator = sitesToFlag.iterator(); iterator.hasNext();) {
-      FlatNew fn = (FlatNew) iterator.next();
-      bw.write( fn+"\n" );
-    }
-    bw.close();
-    }catch(IOException e){
-      
+
+  private void writeFile(Set<FlatNew> sitesToFlag) {
+
+    try {
+      BufferedWriter bw = new BufferedWriter(new FileWriter("sitesToFlag.txt"));
+
+      for (Iterator iterator = sitesToFlag.iterator(); iterator.hasNext();) {
+        FlatNew fn = (FlatNew) iterator.next();
+        bw.write(fn + "\n");
+      }
+      bw.close();
+    } catch (IOException e) {
+
     }
     }
-   
+
   }
 
   private void livenessAnalysisBackward(FlatSESEEnterNode fsen, boolean toplevel,
   }
 
   private void livenessAnalysisBackward(FlatSESEEnterNode fsen, boolean toplevel,
@@ -286,7 +274,8 @@ public class OoOJavaAnalysis {
       flatNodesToVisit.add(fsen.getFlatExit());
     }
 
       flatNodesToVisit.add(fsen.getFlatExit());
     }
 
-    Hashtable<FlatNode, Set<TempDescriptor>> livenessResults = new Hashtable<FlatNode, Set<TempDescriptor>>();
+    Hashtable<FlatNode, Set<TempDescriptor>> livenessResults =
+        new Hashtable<FlatNode, Set<TempDescriptor>>();
 
     if (toplevel) {
       liveout = new Hashtable<FlatSESEExitNode, Set<TempDescriptor>>();
 
     if (toplevel) {
       liveout = new Hashtable<FlatSESEExitNode, Set<TempDescriptor>>();
@@ -458,8 +447,8 @@ public class OoOJavaAnalysis {
       // anything virtually read by this SESE should be pruned
       // of parent or sibling sources
       Set<TempDescriptor> liveVars = livenessRootView.get(fn);
       // anything virtually read by this SESE should be pruned
       // of parent or sibling sources
       Set<TempDescriptor> liveVars = livenessRootView.get(fn);
-      Set<TempDescriptor> fsenVirtReads = vstTable.calcVirtReadsAndPruneParentAndSiblingTokens(
-          fsen, liveVars);
+      Set<TempDescriptor> fsenVirtReads =
+          vstTable.calcVirtReadsAndPruneParentAndSiblingTokens(fsen, liveVars);
       Set<TempDescriptor> fsenVirtReadsOld = livenessVirtualReads.get(fn);
       if (fsenVirtReadsOld != null) {
         fsenVirtReads.addAll(fsenVirtReadsOld);
       Set<TempDescriptor> fsenVirtReadsOld = livenessVirtualReads.get(fn);
       if (fsenVirtReadsOld != null) {
         fsenVirtReads.addAll(fsenVirtReadsOld);
@@ -677,8 +666,8 @@ public class OoOJavaAnalysis {
 
           VariableSourceToken vst = vstIfStatic.vst;
 
 
           VariableSourceToken vst = vstIfStatic.vst;
 
-          Iterator<VariableSourceToken> availItr = vstTable.get(vst.getSESE(), vst.getAge())
-              .iterator();
+          Iterator<VariableSourceToken> availItr =
+              vstTable.get(vst.getSESE(), vst.getAge()).iterator();
 
           // look through things that are also available from same source
           while (availItr.hasNext()) {
 
           // look through things that are also available from same source
           while (availItr.hasNext()) {
@@ -691,8 +680,8 @@ public class OoOJavaAnalysis {
               // if a variable is available from the same source, AND it ALSO
               // only comes from one statically known source, mark it available
               VSTWrapper vstIfStaticNotUsed = new VSTWrapper();
               // if a variable is available from the same source, AND it ALSO
               // only comes from one statically known source, mark it available
               VSTWrapper vstIfStaticNotUsed = new VSTWrapper();
-              Integer srcTypeAlso = vstTable.getRefVarSrcType(refVarAlso, currentSESE,
-                  vstIfStaticNotUsed);
+              Integer srcTypeAlso =
+                  vstTable.getRefVarSrcType(refVarAlso, currentSESE, vstIfStaticNotUsed);
               if (srcTypeAlso.equals(VarSrcTokTable.SrcType_STATIC)) {
                 notAvailSet.remove(refVarAlso);
               }
               if (srcTypeAlso.equals(VarSrcTokTable.SrcType_STATIC)) {
                 notAvailSet.remove(refVarAlso);
               }
@@ -706,85 +695,76 @@ public class OoOJavaAnalysis {
     } // end switch
   }
 
     } // end switch
   }
 
-  
-private void codePlansForward( FlatMethod fm ) {
-    
+  private void codePlansForward(FlatMethod fm) {
+
     // start from flat method top, visit every node in
     // method exactly once
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
     // start from flat method top, visit every node in
     // method exactly once
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
-    flatNodesToVisit.add( fm );
+    flatNodesToVisit.add(fm);
 
 
-    Set<FlatNode> visited = new HashSet<FlatNode>();    
+    Set<FlatNode> visited = new HashSet<FlatNode>();
 
 
-    while( !flatNodesToVisit.isEmpty() ) {
+    while (!flatNodesToVisit.isEmpty()) {
       Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
       FlatNode fn = fnItr.next();
 
       Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
       FlatNode fn = fnItr.next();
 
-      flatNodesToVisit.remove( fn );
-      visited.add( fn );      
+      flatNodesToVisit.remove(fn);
+      visited.add(fn);
 
       Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
 
       Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
-      assert seseStack != null;      
+      assert seseStack != null;
 
       // use incoming results as "dot statement" or just
       // before the current statement
       VarSrcTokTable dotSTtable = new VarSrcTokTable();
 
       // use incoming results as "dot statement" or just
       // before the current statement
       VarSrcTokTable dotSTtable = new VarSrcTokTable();
-      for( int i = 0; i < fn.numPrev(); i++ ) {
-  FlatNode nn = fn.getPrev( i );
-  dotSTtable.merge( variableResults.get( nn ) );
+      for (int i = 0; i < fn.numPrev(); i++) {
+        FlatNode nn = fn.getPrev(i);
+        dotSTtable.merge(variableResults.get(nn));
       }
 
       // find dt-st notAvailableSet also
       }
 
       // find dt-st notAvailableSet also
-      Set<TempDescriptor> dotSTnotAvailSet = new HashSet<TempDescriptor>();      
-      for( int i = 0; i < fn.numPrev(); i++ ) {
-  FlatNode nn = fn.getPrev( i );       
-  Set<TempDescriptor> notAvailIn = notAvailableResults.get( nn );
-        if( notAvailIn != null ) {
-    dotSTnotAvailSet.addAll( notAvailIn );
+      Set<TempDescriptor> dotSTnotAvailSet = new HashSet<TempDescriptor>();
+      for (int i = 0; i < fn.numPrev(); i++) {
+        FlatNode nn = fn.getPrev(i);
+        Set<TempDescriptor> notAvailIn = notAvailableResults.get(nn);
+        if (notAvailIn != null) {
+          dotSTnotAvailSet.addAll(notAvailIn);
         }
       }
 
         }
       }
 
-      Set<TempDescriptor> dotSTlive = livenessRootView.get( fn );
+      Set<TempDescriptor> dotSTlive = livenessRootView.get(fn);
 
 
-      if( !seseStack.empty() ) {
-  codePlans_nodeActions( fn, 
-             dotSTlive,
-             dotSTtable,
-             dotSTnotAvailSet,
-             seseStack.peek()
-             );
+      if (!seseStack.empty()) {
+        codePlans_nodeActions(fn, dotSTlive, dotSTtable, dotSTnotAvailSet, seseStack.peek());
       }
 
       }
 
-      for( int i = 0; i < fn.numNext(); i++ ) {
-  FlatNode nn = fn.getNext( i );
+      for (int i = 0; i < fn.numNext(); i++) {
+        FlatNode nn = fn.getNext(i);
 
 
-  if( !visited.contains( nn ) ) {
-    flatNodesToVisit.add( nn );
-  }
+        if (!visited.contains(nn)) {
+          flatNodesToVisit.add(nn);
+        }
       }
     }
   }
 
       }
     }
   }
 
-  private void codePlans_nodeActions( FlatNode fn,
-              Set<TempDescriptor> liveSetIn,
-              VarSrcTokTable vstTableIn,
-              Set<TempDescriptor> notAvailSetIn,
-              FlatSESEEnterNode currentSESE ) {
-    
-    CodePlan plan = new CodePlan( currentSESE);
+  private void codePlans_nodeActions(FlatNode fn, Set<TempDescriptor> liveSetIn,
+      VarSrcTokTable vstTableIn, Set<TempDescriptor> notAvailSetIn, FlatSESEEnterNode currentSESE) {
+
+    CodePlan plan = new CodePlan(currentSESE);
 
 
-    switch( fn.kind() ) {
+    switch (fn.kind()) {
 
     case FKind.FlatSESEEnterNode: {
       FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
 
     case FKind.FlatSESEEnterNode: {
       FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
-      assert fsen.equals( currentSESE );
+      assert fsen.equals(currentSESE);
 
       // track the source types of the in-var set so generated
       // code at this SESE issue can compute the number of
       // dependencies properly
       Iterator<TempDescriptor> inVarItr = fsen.getInVarSet().iterator();
 
       // track the source types of the in-var set so generated
       // code at this SESE issue can compute the number of
       // dependencies properly
       Iterator<TempDescriptor> inVarItr = fsen.getInVarSet().iterator();
-      while( inVarItr.hasNext() ) {
-  TempDescriptor inVar = inVarItr.next();
+      while (inVarItr.hasNext()) {
+        TempDescriptor inVar = inVarItr.next();
 
         // when we get to an SESE enter node we change the
         // currentSESE variable of this analysis to the
 
         // when we get to an SESE enter node we change the
         // currentSESE variable of this analysis to the
@@ -793,158 +773,141 @@ private void codePlansForward( FlatMethod fm ) {
         // the parent SESE in--at other FlatNode types just
         // use the currentSESE
         VSTWrapper vstIfStatic = new VSTWrapper();
         // the parent SESE in--at other FlatNode types just
         // use the currentSESE
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer srcType = 
-    vstTableIn.getRefVarSrcType( inVar,
-               fsen.getParent(),
-                                       vstIfStatic
-                                       );
-
-  // the current SESE needs a local space to track the dynamic
-  // variable and the child needs space in its SESE record
-  if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    fsen.addDynamicInVar( inVar );
-    fsen.getParent().addDynamicVar( inVar );
-
-  } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {
-    fsen.addStaticInVar( inVar );
-    VariableSourceToken vst = vstIfStatic.vst;
-    fsen.putStaticInVar2src( inVar, vst );
-    fsen.addStaticInVarSrc( new SESEandAgePair( vst.getSESE(), 
-                  vst.getAge() 
-                ) 
-        );
-  } else {
-    assert srcType.equals( VarSrcTokTable.SrcType_READY );
-    fsen.addReadyInVar( inVar );
-  } 
+        Integer srcType = vstTableIn.getRefVarSrcType(inVar, fsen.getParent(), vstIfStatic);
+
+        // the current SESE needs a local space to track the dynamic
+        // variable and the child needs space in its SESE record
+        if (srcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          fsen.addDynamicInVar(inVar);
+          fsen.getParent().addDynamicVar(inVar);
+
+        } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
+          fsen.addStaticInVar(inVar);
+          VariableSourceToken vst = vstIfStatic.vst;
+          fsen.putStaticInVar2src(inVar, vst);
+          fsen.addStaticInVarSrc(new SESEandAgePair(vst.getSESE(), vst.getAge()));
+        } else {
+          assert srcType.equals(VarSrcTokTable.SrcType_READY);
+          fsen.addReadyInVar(inVar);
+        }
       }
 
       }
 
-    } break;
+    }
+      break;
 
     case FKind.FlatSESEExitNode: {
       FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
 
     case FKind.FlatSESEExitNode: {
       FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
-    } break;
+    }
+      break;
 
     case FKind.FlatOpNode: {
       FlatOpNode fon = (FlatOpNode) fn;
 
 
     case FKind.FlatOpNode: {
       FlatOpNode fon = (FlatOpNode) fn;
 
-      if( fon.getOp().getOp() == Operation.ASSIGN ) {
-  TempDescriptor lhs = fon.getDest();
-  TempDescriptor rhs = fon.getLeft();        
+      if (fon.getOp().getOp() == Operation.ASSIGN) {
+        TempDescriptor lhs = fon.getDest();
+        TempDescriptor rhs = fon.getLeft();
 
 
-  // if this is an op node, don't stall, copy
-  // source and delay until we need to use value
+        // if this is an op node, don't stall, copy
+        // source and delay until we need to use value
 
 
-  // ask whether lhs and rhs sources are dynamic, static, etc.
+        // ask whether lhs and rhs sources are dynamic, static, etc.
         VSTWrapper vstIfStatic = new VSTWrapper();
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer lhsSrcType
-    = vstTableIn.getRefVarSrcType( lhs,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-  Integer rhsSrcType
-    = vstTableIn.getRefVarSrcType( rhs,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-
-  if( rhsSrcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // if rhs is dynamic going in, lhs will definitely be dynamic
-    // going out of this node, so track that here   
-    plan.addDynAssign( lhs, rhs );
-    currentSESE.addDynamicVar( lhs );
-    currentSESE.addDynamicVar( rhs );
-
-  } else if( lhsSrcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // otherwise, if the lhs is dynamic, but the rhs is not, we
-    // need to update the variable's dynamic source as "current SESE"
-    plan.addDynAssign( lhs );
-  }       
-
-  // only break if this is an ASSIGN op node,
-  // otherwise fall through to default case
-  break;
+        Integer lhsSrcType = vstTableIn.getRefVarSrcType(lhs, currentSESE, vstIfStatic);
+        Integer rhsSrcType = vstTableIn.getRefVarSrcType(rhs, currentSESE, vstIfStatic);
+
+        if (rhsSrcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // if rhs is dynamic going in, lhs will definitely be dynamic
+          // going out of this node, so track that here
+          plan.addDynAssign(lhs, rhs);
+          currentSESE.addDynamicVar(lhs);
+          currentSESE.addDynamicVar(rhs);
+
+        } else if (lhsSrcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // otherwise, if the lhs is dynamic, but the rhs is not, we
+          // need to update the variable's dynamic source as "current SESE"
+          plan.addDynAssign(lhs);
+        }
+
+        // only break if this is an ASSIGN op node,
+        // otherwise fall through to default case
+        break;
       }
     }
 
       }
     }
 
-    // note that FlatOpNode's that aren't ASSIGN
-    // fall through to this default case
-    default: {          
+      // note that FlatOpNode's that aren't ASSIGN
+      // fall through to this default case
+    default: {
 
       // a node with no live set has nothing to stall for
 
       // a node with no live set has nothing to stall for
-      if( liveSetIn == null ) {
-  break;
+      if (liveSetIn == null) {
+        break;
       }
 
       TempDescriptor[] readarray = fn.readsTemps();
       }
 
       TempDescriptor[] readarray = fn.readsTemps();
-      for( int i = 0; i < readarray.length; i++ ) {
+      for (int i = 0; i < readarray.length; i++) {
         TempDescriptor readtmp = readarray[i];
 
         TempDescriptor readtmp = readarray[i];
 
-  // ignore temps that are definitely available 
-  // when considering to stall on it
-  if( !notAvailSetIn.contains( readtmp ) ) {
-    continue;
-  }
+        // ignore temps that are definitely available
+        // when considering to stall on it
+        if (!notAvailSetIn.contains(readtmp)) {
+          continue;
+        }
 
 
-  // check the source type of this variable
+        // check the source type of this variable
         VSTWrapper vstIfStatic = new VSTWrapper();
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer srcType 
-    = vstTableIn.getRefVarSrcType( readtmp,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-
-  if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // 1) It is not clear statically where this variable will
-    // come from, so dynamically we must keep track
-    // along various control paths, and therefore when we stall,
-    // just stall for the exact thing we need and move on
-    plan.addDynamicStall( readtmp );
-    currentSESE.addDynamicVar( readtmp );  
-
-  } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {    
-    // 2) Single token/age pair: Stall for token/age pair, and copy
-    // all live variables with same token/age pair at the same
-    // time.  This is the same stuff that the notavaialable analysis 
-    // marks as now available.    
-    VariableSourceToken vst = vstIfStatic.vst;
-
-    Iterator<VariableSourceToken> availItr = 
-      vstTableIn.get( vst.getSESE(), vst.getAge() ).iterator();
-
-    while( availItr.hasNext() ) {
-      VariableSourceToken vstAlsoAvail = availItr.next();
-
-      // only grab additional stuff that is live
-      Set<TempDescriptor> copySet = new HashSet<TempDescriptor>();
-
-      Iterator<TempDescriptor> refVarItr = vstAlsoAvail.getRefVars().iterator();
-      while( refVarItr.hasNext() ) {
-        TempDescriptor refVar = refVarItr.next();
-        if( liveSetIn.contains( refVar ) ) {
-    copySet.add( refVar );
-        }
-      }
+        Integer srcType = vstTableIn.getRefVarSrcType(readtmp, currentSESE, vstIfStatic);
+
+        if (srcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // 1) It is not clear statically where this variable will
+          // come from, so dynamically we must keep track
+          // along various control paths, and therefore when we stall,
+          // just stall for the exact thing we need and move on
+          plan.addDynamicStall(readtmp);
+          currentSESE.addDynamicVar(readtmp);
+
+        } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
+          // 2) Single token/age pair: Stall for token/age pair, and copy
+          // all live variables with same token/age pair at the same
+          // time. This is the same stuff that the notavaialable analysis
+          // marks as now available.
+          VariableSourceToken vst = vstIfStatic.vst;
 
 
-      if( !copySet.isEmpty() ) {
-        plan.addStall2CopySet( vstAlsoAvail, copySet );
-      }
-    }          
+          Iterator<VariableSourceToken> availItr =
+              vstTableIn.get(vst.getSESE(), vst.getAge()).iterator();
 
 
-  } else {
-    // the other case for srcs is READY, so do nothing
-  }
+          while (availItr.hasNext()) {
+            VariableSourceToken vstAlsoAvail = availItr.next();
 
 
-  // assert that everything being stalled for is in the
-  // "not available" set coming into this flat node and
-  // that every VST identified is in the possible "stall set"
-  // that represents VST's from children SESE's
+            // only grab additional stuff that is live
+            Set<TempDescriptor> copySet = new HashSet<TempDescriptor>();
 
 
-      }      
-    } break;
-      
-    } // end switch
+            Iterator<TempDescriptor> refVarItr = vstAlsoAvail.getRefVars().iterator();
+            while (refVarItr.hasNext()) {
+              TempDescriptor refVar = refVarItr.next();
+              if (liveSetIn.contains(refVar)) {
+                copySet.add(refVar);
+              }
+            }
+
+            if (!copySet.isEmpty()) {
+              plan.addStall2CopySet(vstAlsoAvail, copySet);
+            }
+          }
+
+        } else {
+          // the other case for srcs is READY, so do nothing
+        }
+
+        // assert that everything being stalled for is in the
+        // "not available" set coming into this flat node and
+        // that every VST identified is in the possible "stall set"
+        // that represents VST's from children SESE's
 
 
+      }
+    }
+      break;
+
+    } // end switch
 
     // identify sese-age pairs that are statically useful
     // and should have an associated SESE variable in code
 
     // identify sese-age pairs that are statically useful
     // and should have an associated SESE variable in code
@@ -952,71 +915,61 @@ private void codePlansForward( FlatMethod fm ) {
     // AND ALWAYS GIVE NAMES TO PARENTS
     Set<VariableSourceToken> staticSet = vstTableIn.get();
     Iterator<VariableSourceToken> vstItr = staticSet.iterator();
     // AND ALWAYS GIVE NAMES TO PARENTS
     Set<VariableSourceToken> staticSet = vstTableIn.get();
     Iterator<VariableSourceToken> vstItr = staticSet.iterator();
-    while( vstItr.hasNext() ) {
+    while (vstItr.hasNext()) {
       VariableSourceToken vst = vstItr.next();
 
       // placeholder source tokens are useful results, but
       // the placeholder static name is never needed
       VariableSourceToken vst = vstItr.next();
 
       // placeholder source tokens are useful results, but
       // the placeholder static name is never needed
-      if( vst.getSESE().getIsCallerSESEplaceholder() ) {
-  continue;
+      if (vst.getSESE().getIsCallerSESEplaceholder()) {
+        continue;
       }
 
       FlatSESEEnterNode sese = currentSESE;
       }
 
       FlatSESEEnterNode sese = currentSESE;
-      while( sese != null ) {
-  sese.addNeededStaticName( 
-         new SESEandAgePair( vst.getSESE(), vst.getAge() ) 
-          );
-  sese.mustTrackAtLeastAge( vst.getAge() );
-        
-  sese = sese.getParent();
+      while (sese != null) {
+        sese.addNeededStaticName(new SESEandAgePair(vst.getSESE(), vst.getAge()));
+        sese.mustTrackAtLeastAge(vst.getAge());
+
+        sese = sese.getParent();
       }
     }
 
       }
     }
 
+    codePlans.put(fn, plan);
 
 
-    codePlans.put( fn, plan );
-
-
-    // if any variables at this-node-*dot* have a static source (exactly one vst)
+    // if any variables at this-node-*dot* have a static source (exactly one
+    // vst)
     // but go to a dynamic source at next-node-*dot*, create a new IR graph
     // node on that edge to track the sources dynamically
     // but go to a dynamic source at next-node-*dot*, create a new IR graph
     // node on that edge to track the sources dynamically
-    VarSrcTokTable thisVstTable = variableResults.get( fn );
-    for( int i = 0; i < fn.numNext(); i++ ) {
-      FlatNode            nn           = fn.getNext( i );
-      VarSrcTokTable      nextVstTable = variableResults.get( nn );
-      Set<TempDescriptor> nextLiveIn   = livenessRootView.get( nn );
+    VarSrcTokTable thisVstTable = variableResults.get(fn);
+    for (int i = 0; i < fn.numNext(); i++) {
+      FlatNode nn = fn.getNext(i);
+      VarSrcTokTable nextVstTable = variableResults.get(nn);
+      Set<TempDescriptor> nextLiveIn = livenessRootView.get(nn);
 
       // the table can be null if it is one of the few IR nodes
       // completely outside of the root SESE scope
 
       // the table can be null if it is one of the few IR nodes
       // completely outside of the root SESE scope
-      if( nextVstTable != null && nextLiveIn != null ) {
-
-  Hashtable<TempDescriptor, VSTWrapper> readyOrStatic2dynamicSet = 
-    thisVstTable.getReadyOrStatic2DynamicSet( nextVstTable, 
-                                                    nextLiveIn,
-                                                    currentSESE
-                                                    );
-  
-  if( !readyOrStatic2dynamicSet.isEmpty() ) {
-
-    // either add these results to partial fixed-point result
-    // or make a new one if we haven't made any here yet
-    FlatEdge fe = new FlatEdge( fn, nn );
-    FlatWriteDynamicVarNode fwdvn = wdvNodesToSpliceIn.get( fe );
-
-    if( fwdvn == null ) {
-      fwdvn = new FlatWriteDynamicVarNode( fn, 
-             nn,
-             readyOrStatic2dynamicSet,
-             currentSESE
-             );
-      wdvNodesToSpliceIn.put( fe, fwdvn );
-    } else {
-      fwdvn.addMoreVar2Src( readyOrStatic2dynamicSet );
-    }
-  }
+      if (nextVstTable != null && nextLiveIn != null) {
+
+        Hashtable<TempDescriptor, VSTWrapper> readyOrStatic2dynamicSet =
+            thisVstTable.getReadyOrStatic2DynamicSet(nextVstTable, nextLiveIn, currentSESE);
+
+        if (!readyOrStatic2dynamicSet.isEmpty()) {
+
+          // either add these results to partial fixed-point result
+          // or make a new one if we haven't made any here yet
+          FlatEdge fe = new FlatEdge(fn, nn);
+          FlatWriteDynamicVarNode fwdvn = wdvNodesToSpliceIn.get(fe);
+
+          if (fwdvn == null) {
+            fwdvn = new FlatWriteDynamicVarNode(fn, nn, readyOrStatic2dynamicSet, currentSESE);
+            wdvNodesToSpliceIn.put(fe, fwdvn);
+          } else {
+            fwdvn.addMoreVar2Src(readyOrStatic2dynamicSet);
+          }
+        }
       }
     }
   }
       }
     }
   }
-  
+
   private void makeConflictGraph(FlatMethod fm) {
 
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
   private void makeConflictGraph(FlatMethod fm) {
 
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
@@ -1053,7 +1006,6 @@ private void codePlansForward( FlatMethod fm ) {
     }
 
   }
     }
 
   }
 
   private void conflictGraph_nodeAction(FlatNode fn, FlatSESEEnterNode currentSESE) {
 
 
   private void conflictGraph_nodeAction(FlatNode fn, FlatSESEEnterNode currentSESE) {
 
@@ -1177,7 +1129,7 @@ private void codePlansForward( FlatMethod fm ) {
       ConflictGraph conflictGraph = sese2conflictGraph.get(sese);
       if (useReachInfo) {
         // clear current conflict before recalculating with reachability info
       ConflictGraph conflictGraph = sese2conflictGraph.get(sese);
       if (useReachInfo) {
         // clear current conflict before recalculating with reachability info
-        conflictGraph.clearAllConflictEdge(); 
+        conflictGraph.clearAllConflictEdge();
         conflictGraph.setDisJointAnalysis(disjointAnalysisReach);
         conflictGraph.setFMEnclosing(sese.getfmEnclosing());
       }
         conflictGraph.setDisJointAnalysis(disjointAnalysisReach);
         conflictGraph.setFMEnclosing(sese.getfmEnclosing());
       }
@@ -1185,7 +1137,7 @@ private void codePlansForward( FlatMethod fm ) {
       sese2conflictGraph.put(sese, conflictGraph);
     }
   }
       sese2conflictGraph.put(sese, conflictGraph);
     }
   }
-  
+
   private void writeConflictGraph() {
     Enumeration<FlatNode> keyEnum = sese2conflictGraph.keys();
     while (keyEnum.hasMoreElements()) {
   private void writeConflictGraph() {
     Enumeration<FlatNode> keyEnum = sese2conflictGraph.keys();
     while (keyEnum.hasMoreElements()) {
@@ -1201,7 +1153,7 @@ private void codePlansForward( FlatMethod fm ) {
       }
     }
   }
       }
     }
   }
-  
+
   private void synthesizeLocks() {
     Set<Entry<FlatNode, ConflictGraph>> graphEntrySet = sese2conflictGraph.entrySet();
     for (Iterator iterator = graphEntrySet.iterator(); iterator.hasNext();) {
   private void synthesizeLocks() {
     Set<Entry<FlatNode, ConflictGraph>> graphEntrySet = sese2conflictGraph.entrySet();
     for (Iterator iterator = graphEntrySet.iterator(); iterator.hasNext();) {
@@ -1211,7 +1163,7 @@ private void codePlansForward( FlatMethod fm ) {
       calculateCovering(conflictGraph);
     }
   }
       calculateCovering(conflictGraph);
     }
   }
-  
+
   private void calculateCovering(ConflictGraph conflictGraph) {
     uniqueLockSetId = 0; // reset lock counter for every new conflict graph
     HashSet<ConflictEdge> fineToCover = new HashSet<ConflictEdge>();
   private void calculateCovering(ConflictGraph conflictGraph) {
     uniqueLockSetId = 0; // reset lock counter for every new conflict graph
     HashSet<ConflictEdge> fineToCover = new HashSet<ConflictEdge>();
@@ -1299,8 +1251,8 @@ private void codePlansForward( FlatMethod fm ) {
             // but the edge must remain uncovered.
 
             changed = true;
             // but the edge must remain uncovered.
 
             changed = true;
-            
-            if(seseLock.containsConflictNode(newNode)){
+
+            if (seseLock.containsConflictNode(newNode)) {
               seseLock.addEdge(edge);
               fineToCover.remove(edge);
               break;
               seseLock.addEdge(edge);
               fineToCover.remove(edge);
               break;
@@ -1369,13 +1321,13 @@ private void codePlansForward( FlatMethod fm ) {
               seseLock.addConflictNode(edge.getVertexU(), type);
             } else {
               if (edge.getVertexU().isStallSiteNode()) {
               seseLock.addConflictNode(edge.getVertexU(), type);
             } else {
               if (edge.getVertexU().isStallSiteNode()) {
-                if(edge.getVertexU().getWriteEffectSet().isEmpty()){
+                if (edge.getVertexU().getWriteEffectSet().isEmpty()) {
                   type = ConflictNode.PARENT_READ;
                   type = ConflictNode.PARENT_READ;
-                }else{
+                } else {
                   type = ConflictNode.PARENT_WRITE;
                 }
               } else {
                   type = ConflictNode.PARENT_WRITE;
                 }
               } else {
-                  type = ConflictNode.COARSE;
+                type = ConflictNode.COARSE;
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             }
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             }
@@ -1389,12 +1341,12 @@ private void codePlansForward( FlatMethod fm ) {
               }
               seseLock.addConflictNode(edge.getVertexV(), type);
             } else {
               }
               seseLock.addConflictNode(edge.getVertexV(), type);
             } else {
-              if (edge.getVertexV().isStallSiteNode()) {                
-                if(edge.getVertexV().getWriteEffectSet().isEmpty()){
+              if (edge.getVertexV().isStallSiteNode()) {
+                if (edge.getVertexV().getWriteEffectSet().isEmpty()) {
                   type = ConflictNode.PARENT_READ;
                   type = ConflictNode.PARENT_READ;
-                }else{
+                } else {
                   type = ConflictNode.PARENT_WRITE;
                   type = ConflictNode.PARENT_WRITE;
-                }                
+                }
               } else {
                 type = ConflictNode.COARSE;
               }
               } else {
                 type = ConflictNode.COARSE;
               }
@@ -1411,10 +1363,9 @@ private void codePlansForward( FlatMethod fm ) {
             // new node has a coarse-grained edge to all fine-read, fine-write,
             // parent
             changed = true;
             // new node has a coarse-grained edge to all fine-read, fine-write,
             // parent
             changed = true;
-            
-            if(newNode.isInVarNode() &&
-                (!seseLock.hasSelfCoarseEdge(newNode)) &&
-                seseLock.hasCoarseEdgeWithParentCoarse(newNode)){
+
+            if (newNode.isInVarNode() && (!seseLock.hasSelfCoarseEdge(newNode))
+                && seseLock.hasCoarseEdgeWithParentCoarse(newNode)) {
               // this case can't be covered by this queue
               coarseToCover.remove(edge);
               break;
               // this case can't be covered by this queue
               coarseToCover.remove(edge);
               break;
@@ -1474,38 +1425,38 @@ private void codePlansForward( FlatMethod fm ) {
 
     conflictGraph2SESELock.put(conflictGraph, lockSet);
   }
 
     conflictGraph2SESELock.put(conflictGraph, lockSet);
   }
-  
-  public ConflictGraph getConflictGraph(FlatNode sese){
-    return sese2conflictGraph.get(sese);    
+
+  public ConflictGraph getConflictGraph(FlatNode sese) {
+    return sese2conflictGraph.get(sese);
   }
   }
-  
-  public Set<SESELock> getLockMappings(ConflictGraph graph){
+
+  public Set<SESELock> getLockMappings(ConflictGraph graph) {
     return conflictGraph2SESELock.get(graph);
   }
     return conflictGraph2SESELock.get(graph);
   }
-  
+
   public Set<FlatSESEEnterNode> getAllSESEs() {
     return rblockRel.getAllSESEs();
   }
   public Set<FlatSESEEnterNode> getAllSESEs() {
     return rblockRel.getAllSESEs();
   }
-  
+
   public FlatSESEEnterNode getMainSESE() {
     return rblockRel.getMainSESE();
   }
   public FlatSESEEnterNode getMainSESE() {
     return rblockRel.getMainSESE();
   }
-  
-  public void writeReports( String timeReport ) throws java.io.IOException {
-
-    BufferedWriter bw = new BufferedWriter( new FileWriter( "mlpReport_summary.txt" ) );
-    bw.write( "MLP Analysis Results\n\n" );
-    bw.write( timeReport+"\n\n" );
-    printSESEHierarchy( bw );
-    bw.write( "\n" );
-    printSESEInfo( bw );
+
+  public void writeReports(String timeReport) throws java.io.IOException {
+
+    BufferedWriter bw = new BufferedWriter(new FileWriter("mlpReport_summary.txt"));
+    bw.write("MLP Analysis Results\n\n");
+    bw.write(timeReport + "\n\n");
+    printSESEHierarchy(bw);
+    bw.write("\n");
+    printSESEInfo(bw);
     bw.close();
 
     Iterator<Descriptor> methItr = disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
     bw.close();
 
     Iterator<Descriptor> methItr = disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
-    while( methItr.hasNext() ) {
-      MethodDescriptor md = (MethodDescriptor) methItr.next();      
-      FlatMethod       fm = state.getMethodFlat( md );
-      if (fm!=null) {
+    while (methItr.hasNext()) {
+      MethodDescriptor md = (MethodDescriptor) methItr.next();
+      FlatMethod fm = state.getMethodFlat(md);
+      if (fm != null) {
         bw =
             new BufferedWriter(new FileWriter("mlpReport_" + md.getClassMethodName()
                 + md.getSafeMethodDescriptor() + ".txt"));
         bw =
             new BufferedWriter(new FileWriter("mlpReport_" + md.getClassMethodName()
                 + md.getSafeMethodDescriptor() + ".txt"));
@@ -1527,91 +1478,86 @@ private void codePlansForward( FlatMethod fm ) {
       }
     }
   }
       }
     }
   }
-  
-  private void printSESEHierarchy( BufferedWriter bw ) throws java.io.IOException {
-    bw.write( "SESE Hierarchy\n--------------\n" ); 
+
+  private void printSESEHierarchy(BufferedWriter bw) throws java.io.IOException {
+    bw.write("SESE Hierarchy\n--------------\n");
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
-    while( rootItr.hasNext() ) {
+    while (rootItr.hasNext()) {
       FlatSESEEnterNode root = rootItr.next();
       FlatSESEEnterNode root = rootItr.next();
-      if( root.getIsCallerSESEplaceholder() ) {
-  if( !root.getChildren().isEmpty() ) {
-    printSESEHierarchyTree( bw, root, 0 );
-  }
+      if (root.getIsCallerSESEplaceholder()) {
+        if (!root.getChildren().isEmpty()) {
+          printSESEHierarchyTree(bw, root, 0);
+        }
       } else {
       } else {
-  printSESEHierarchyTree( bw, root, 0 );
+        printSESEHierarchyTree(bw, root, 0);
       }
     }
   }
 
       }
     }
   }
 
-  private void printSESEHierarchyTree( BufferedWriter bw,
-               FlatSESEEnterNode fsen,
-               int depth 
-             ) throws java.io.IOException {
-    for( int i = 0; i < depth; ++i ) {
-      bw.write( "  " );
+  private void printSESEHierarchyTree(BufferedWriter bw, FlatSESEEnterNode fsen, int depth)
+      throws java.io.IOException {
+    for (int i = 0; i < depth; ++i) {
+      bw.write("  ");
     }
     }
-    bw.write( "- "+fsen.getPrettyIdentifier()+"\n" );
+    bw.write("- " + fsen.getPrettyIdentifier() + "\n");
 
     Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
 
     Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
-    while( childItr.hasNext() ) {
+    while (childItr.hasNext()) {
       FlatSESEEnterNode fsenChild = childItr.next();
       FlatSESEEnterNode fsenChild = childItr.next();
-      printSESEHierarchyTree( bw, fsenChild, depth + 1 );
+      printSESEHierarchyTree(bw, fsenChild, depth + 1);
     }
   }
 
     }
   }
 
-  
-  private void printSESEInfo( BufferedWriter bw ) throws java.io.IOException {
-    bw.write("\nSESE info\n-------------\n" ); 
+  private void printSESEInfo(BufferedWriter bw) throws java.io.IOException {
+    bw.write("\nSESE info\n-------------\n");
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
     Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
-    while( rootItr.hasNext() ) {
+    while (rootItr.hasNext()) {
       FlatSESEEnterNode root = rootItr.next();
       FlatSESEEnterNode root = rootItr.next();
-      if( root.getIsCallerSESEplaceholder() ) {
-  if( !root.getChildren().isEmpty() ) {
-    printSESEInfoTree( bw, root );
-  }
+      if (root.getIsCallerSESEplaceholder()) {
+        if (!root.getChildren().isEmpty()) {
+          printSESEInfoTree(bw, root);
+        }
       } else {
       } else {
-  printSESEInfoTree( bw, root );
+        printSESEInfoTree(bw, root);
       }
     }
   }
       }
     }
   }
-  
-  public DisjointAnalysis getDisjointAnalysis(){
-    return disjointAnalysisReach;
+
+  public DisjointAnalysis getDisjointAnalysis() {
+    return disjointAnalysisTaints;
   }
 
   }
 
-  private void printSESEInfoTree( BufferedWriter bw,
-          FlatSESEEnterNode fsen 
-        ) throws java.io.IOException {
+  private void printSESEInfoTree(BufferedWriter bw, FlatSESEEnterNode fsen)
+      throws java.io.IOException {
 
 
-    if( !fsen.getIsCallerSESEplaceholder() ) {
-      bw.write( "SESE "+fsen.getPrettyIdentifier()+" {\n" );
+    if (!fsen.getIsCallerSESEplaceholder()) {
+      bw.write("SESE " + fsen.getPrettyIdentifier() + " {\n");
 
 
-      bw.write( "  in-set: "+fsen.getInVarSet()+"\n" );
+      bw.write("  in-set: " + fsen.getInVarSet() + "\n");
       Iterator<TempDescriptor> tItr = fsen.getInVarSet().iterator();
       Iterator<TempDescriptor> tItr = fsen.getInVarSet().iterator();
-      while( tItr.hasNext() ) {
-  TempDescriptor inVar = tItr.next();
-  if( fsen.getReadyInVarSet().contains( inVar ) ) {
-    bw.write( "    (ready)  "+inVar+"\n" );
-  }
-  if( fsen.getStaticInVarSet().contains( inVar ) ) {
-    bw.write( "    (static) "+inVar+" from "+
-                    fsen.getStaticInVarSrc( inVar )+"\n" );
-  } 
-  if( fsen.getDynamicInVarSet().contains( inVar ) ) {
-    bw.write( "    (dynamic)"+inVar+"\n" );
-  }
+      while (tItr.hasNext()) {
+        TempDescriptor inVar = tItr.next();
+        if (fsen.getReadyInVarSet().contains(inVar)) {
+          bw.write("    (ready)  " + inVar + "\n");
+        }
+        if (fsen.getStaticInVarSet().contains(inVar)) {
+          bw.write("    (static) " + inVar + " from " + fsen.getStaticInVarSrc(inVar) + "\n");
+        }
+        if (fsen.getDynamicInVarSet().contains(inVar)) {
+          bw.write("    (dynamic)" + inVar + "\n");
+        }
       }
       }
-      
-      bw.write( "   Dynamic vars to manage: "+fsen.getDynamicVarSet()+"\n");
-      
-      bw.write( "  out-set: "+fsen.getOutVarSet()+"\n" );
-      bw.write( "}\n" );
+
+      bw.write("   Dynamic vars to manage: " + fsen.getDynamicVarSet() + "\n");
+
+      bw.write("  out-set: " + fsen.getOutVarSet() + "\n");
+      bw.write("}\n");
     }
 
     Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
     }
 
     Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
-    while( childItr.hasNext() ) {
+    while (childItr.hasNext()) {
       FlatSESEEnterNode fsenChild = childItr.next();
       FlatSESEEnterNode fsenChild = childItr.next();
-      printSESEInfoTree( bw, fsenChild );
+      printSESEInfoTree(bw, fsenChild);
     }
   }
 
     }
   }
 
index 0c57e83ebc096464b7ebd222aa81f250ddd2c0bb..5159f7ebbb051af5b165bed52e0f572ea66836b0 100644 (file)
@@ -23,7 +23,9 @@ import Analysis.Locality.DCWrapper;
 import Analysis.Locality.DelayComputation;
 import Analysis.Locality.BranchAnalysis;
 import Analysis.CallGraph.CallGraph;
 import Analysis.Locality.DelayComputation;
 import Analysis.Locality.BranchAnalysis;
 import Analysis.CallGraph.CallGraph;
+import Analysis.Disjoint.Effect;
 import Analysis.Disjoint.ReachGraph;
 import Analysis.Disjoint.ReachGraph;
+import Analysis.Disjoint.Taint;
 import Analysis.OoOJava.OoOJavaAnalysis;
 import Analysis.Prefetch.*;
 import Analysis.Loops.WriteBarrier;
 import Analysis.OoOJava.OoOJavaAnalysis;
 import Analysis.Prefetch.*;
 import Analysis.Loops.WriteBarrier;
@@ -257,12 +259,24 @@ public class BuildCode {
         FlatSESEEnterNode fsen = seseit.next();
         initializeSESE( fsen );
         
         FlatSESEEnterNode fsen = seseit.next();
         initializeSESE( fsen );
         
-        // invoke rcr
+        /*
         if(state.RCR){
         if(state.RCR){
-//          FlatMethod fm=fsen.getfmEnclosing();        
-//          ReachGraph rg=oooa.getDisjointAnalysis().getReachGraph(fm.getMethod());
+          if(!fsen.getIsCallerSESEplaceholder() && fsen.getParent()!=null){
+            
+            FlatMethod fm=fsen.getfmEnclosing();
+            
+            //reach graph
+            ReachGraph rg=oooa.getDisjointAnalysis().getReachGraph(fm.getMethod());
+            
+            //get effect set
+            Hashtable<Taint, Set<Effect>>  effects=oooa.getDisjointAnalysis().getEffectsAnalysis().get(fsen);
+            
+            //get conflict set
+            Analysis.OoOJava.ConflictGraph conflictGraph=oooa.getConflictGraph(fsen.getParent());
+            Hashtable<Taint, Set<Effect>>  conflicts=conflictGraph.getConflictEffectSet(fsen);
+          }
         }
         }
-        
+        */
       }
       
     }
       }
       
     }