changes.
authoryeom <yeom>
Fri, 23 Jul 2010 03:53:40 +0000 (03:53 +0000)
committeryeom <yeom>
Fri, 23 Jul 2010 03:53:40 +0000 (03:53 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/OoOJava/ConflictGraph.java
Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java
Robust/src/Analysis/OoOJava/SESELock.java

index 6b8e9c5505b1eb75706de1db8f1b48cc71f399e8..d3e41d34ec4c05310694c5bde663eef4dc37f67d 100644 (file)
@@ -1382,7 +1382,23 @@ public class DisjointAnalysis {
       FlatCall         fc       = (FlatCall) fn;
       MethodDescriptor mdCallee = fc.getMethod();
       FlatMethod       fmCallee = state.getMethodFlat( mdCallee );
-
+      
+      // before transfer func, possibly inject
+      // stall-site taints
+      if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+          
+        if(rblockStatus.isInCriticalRegion(fmContaining, fn)){
+          // x.y=f , stall x and y if they are not accessible
+          // also contribute write effects on stall site of x
+          if(!rg.isAccessible(fc.getThis())) {
+            rg.taintStallSite(fn, fc.getThis());
+          }
+            
+          // accessible status update
+          rg.makeAccessible(fc.getThis());
+        }
+      }
+      
 
       boolean debugCallSite =
         mdCaller.getSymbol().equals( state.DISJOINTDEBUGCALLER ) &&
index 82d1d3e904f26b3ffb73f2f12989bcc3b1c53c5f..58d5cd7346c15ee982e9677951f2b89e5304891d 100644 (file)
@@ -289,8 +289,8 @@ public class ConflictGraph {
       Iterator effectItrB = readTableB.entrySet().iterator();
       while (effectItrB.hasNext()) {
         Map.Entry meB = (Map.Entry) effectItrB.next();
-        AllocSite asB = (AllocSite) meA.getKey();
-        Set<Effect> esB = (Set<Effect>) meA.getValue();
+        AllocSite asB = (AllocSite) meB.getKey();
+        Set<Effect> esB = (Set<Effect>) meB.getValue();
 
         for (Iterator iterator = strongUpdateSetA.iterator(); iterator.hasNext();) {
           Effect strongUpdateA = (Effect) iterator.next();
@@ -319,8 +319,8 @@ public class ConflictGraph {
       effectItrB = writeTableB.entrySet().iterator();
       while (effectItrB.hasNext()) {
         Map.Entry meB = (Map.Entry) effectItrB.next();
-        AllocSite asB = (AllocSite) meA.getKey();
-        Set<Effect> esB = (Set<Effect>) meA.getValue();
+        AllocSite asB = (AllocSite) meB.getKey();
+        Set<Effect> esB = (Set<Effect>) meB.getValue();
 
         for (Iterator iterator = strongUpdateSetA.iterator(); iterator.hasNext();) {
           Effect strongUpdateA = (Effect) iterator.next();
@@ -618,6 +618,7 @@ public class ConflictGraph {
               newElement.setStatus(seseLock.getNodeType(node));
               if (isFineElement(newElement.getStatus())) {
                 newElement.setDynID(node.getVar().toString());
+                newElement.setTempDesc(node.getVar());
               }
               waitingElementSet.add(newElement);
             }
index 0f1016eac11a2e2170ce12430370d26d974f8f07..21815ea0549825af5478536d4dbc58bc5c44ad10 100644 (file)
@@ -30,6 +30,7 @@ import IR.Operation;
 import IR.State;
 import IR.TypeUtil;
 import IR.Flat.FKind;
+import IR.Flat.FlatCall;
 import IR.Flat.FlatEdge;
 import IR.Flat.FlatElementNode;
 import IR.Flat.FlatFieldNode;
@@ -1080,11 +1081,11 @@ private void codePlansForward( FlatMethod fm ) {
         conflictGraph = new ConflictGraph();
       }
 
-      if( fn instanceof FlatFieldNode){
-        FlatFieldNode ffn = (FlatFieldNode)fn;
+      if (fn instanceof FlatFieldNode) {
+        FlatFieldNode ffn = (FlatFieldNode) fn;
         rhs = ffn.getSrc();
-      }else{
-        FlatElementNode fen = (FlatElementNode)fn;
+      } else {
+        FlatElementNode fen = (FlatElementNode) fn;
         rhs = fen.getSrc();
       }
 
@@ -1106,16 +1107,16 @@ private void codePlansForward( FlatMethod fm ) {
         conflictGraph = new ConflictGraph();
       }
 
-      if( fn instanceof FlatSetFieldNode){
+      if (fn instanceof FlatSetFieldNode) {
         FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
         lhs = fsfn.getDst();
         rhs = fsfn.getSrc();
-      }else{
+      } else {
         FlatSetElementNode fsen = (FlatSetElementNode) fn;
         lhs = fsen.getDst();
         rhs = fsen.getSrc();
       }
-      
+
       // collects effects of stall site and generates stall site node
       Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
       conflictGraph.addStallSite(taint2Effects, rhs);
@@ -1126,6 +1127,26 @@ private void codePlansForward( FlatMethod fm ) {
       }
     }
       break;
+
+    case FKind.FlatCall: {
+      conflictGraph = sese2conflictGraph.get(currentSESE);
+      if (conflictGraph == null) {
+        conflictGraph = new ConflictGraph();
+      }
+
+      FlatCall fc = (FlatCall) fn;
+      lhs = fc.getThis();
+
+      // collects effects of stall site and generates stall site node
+      Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
+      conflictGraph.addStallSite(taint2Effects, lhs);
+      if (conflictGraph.id2cn.size() > 0) {
+        sese2conflictGraph.put(currentSESE, conflictGraph);
+      }
+    }
+
+      break;
+
     }
 
   }
@@ -1312,7 +1333,6 @@ private void codePlansForward( FlatMethod fm ) {
         for (Iterator iterator = coarseToCover.iterator(); iterator.hasNext();) {
 
           ConflictEdge edge = (ConflictEdge) iterator.next();
-
           if (seseLock.getConflictNodeSet().size() == 0) {
             // initial setup
             if (seseLock.hasSelfCoarseEdge(edge.getVertexU())) {
@@ -1321,14 +1341,18 @@ private void codePlansForward( FlatMethod fm ) {
                 // and it is not parent
                 type = ConflictNode.SCC;
               } else {
-                type = ConflictNode.PARENT_COARSE;
+                type = ConflictNode.PARENT_WRITE;
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             } else {
               if (edge.getVertexU().isStallSiteNode()) {
-                type = ConflictNode.PARENT_COARSE;
+                if(edge.getVertexU().getWriteEffectSet().isEmpty()){
+                  type = ConflictNode.PARENT_READ;
+                }else{
+                  type = ConflictNode.PARENT_WRITE;
+                }
               } else {
-                type = ConflictNode.COARSE;
+                  type = ConflictNode.COARSE;
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             }
@@ -1338,12 +1362,16 @@ private void codePlansForward( FlatMethod fm ) {
                 // and it is not parent
                 type = ConflictNode.SCC;
               } else {
-                type = ConflictNode.PARENT_COARSE;
+                type = ConflictNode.PARENT_WRITE;
               }
               seseLock.addConflictNode(edge.getVertexV(), type);
             } else {
-              if (edge.getVertexV().isStallSiteNode()) {
-                type = ConflictNode.PARENT_COARSE;
+              if (edge.getVertexV().isStallSiteNode()) {                
+                if(edge.getVertexV().getWriteEffectSet().isEmpty()){
+                  type = ConflictNode.PARENT_READ;
+                }else{
+                  type = ConflictNode.PARENT_WRITE;
+                }                
               } else {
                 type = ConflictNode.COARSE;
               }
@@ -1360,6 +1388,14 @@ private void codePlansForward( FlatMethod fm ) {
             // 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)){
+              // this case can't be covered by this queue
+              coarseToCover.remove(edge);
+              break;
+            }
 
             if (seseLock.hasSelfCoarseEdge(newNode)) {
               // SCC
index b69dc6c35ce42dd96f295a8489cdabc52131f318..77533ce54872669e728fd9100f11d1bc074a39e1 100644 (file)
@@ -32,7 +32,7 @@ public class SESELock {
   }
 
   public void addConflictEdge(ConflictEdge e) {
-    conflictEdgeSet.add(e);
+      conflictEdgeSet.add(e);
   }
 
   public boolean containsConflictEdge(ConflictEdge e) {
@@ -63,6 +63,39 @@ public class SESELock {
     }
     return false;
   }
+  
+  public boolean hasSelfEdge(ConflictNode node) {
+
+    Set<ConflictEdge> set = node.getEdgeSet();
+    for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+      ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
+
+      if ((!conflictEdge.isCoarseEdge()) && conflictEdge.getVertexU() == conflictEdge.getVertexV()) {
+        return true;
+      }
+    }
+    return false;
+  }
+  
+  public boolean hasCoarseEdgeWithParentCoarse(ConflictNode node) {
+
+    Set<ConflictEdge> set = node.getEdgeSet();
+    for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+      ConflictEdge conflictEdge = (ConflictEdge) iterator.next();
+
+      ConflictNode cNode;
+      if (conflictEdge.getVertexU() == node) {
+        cNode = conflictEdge.getVertexV();
+      } else {
+        cNode = conflictEdge.getVertexU();
+      }
+      Integer cNodeTypeIn = nodeTypeMap.get(cNode);
+      if (cNodeTypeIn != null && cNodeTypeIn.intValue() == ConflictNode.PARENT_COARSE) {
+        return true;
+      }
+    }
+    return false;
+  }
 
   public ConflictNode getNewNodeConnectedWithGroup(ConflictEdge newEdge) {