import java.util.Map.Entry;
import Analysis.OwnershipAnalysis.HeapRegionNode;
+import Analysis.OwnershipAnalysis.TokenTuple;
import IR.Flat.FlatMethod;
import IR.Flat.FlatSESEEnterNode;
import IR.Flat.TempDescriptor;
public class ConflictGraph {
- public Hashtable<String, ConflictNode> td2cn;
+ public Hashtable<String, ConflictNode> id2cn;
public ConflictGraph() {
- td2cn = new Hashtable<String, ConflictNode>();
+ id2cn = new Hashtable<String, ConflictNode>();
+ }
+
+ public void analyzeConflicts() {
+ Set<String> keySet = id2cn.keySet();
+ for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
+ String nodeID = (String) iterator.next();
+ ConflictNode node = id2cn.get(nodeID);
+ analyzePossibleConflicts(node);
+ }
+ }
+
+ public void analyzePossibleConflicts(ConflictNode node) {
+
+ // compare with all nodes
+
+ Set<Set> nodeReachabilitySet = node.getReachabilitySet();
+
+ Set<Entry<String, ConflictNode>> set = id2cn.entrySet();
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Entry<String, ConflictNode> entry = (Entry<String, ConflictNode>) iterator
+ .next();
+
+ String currentNodeID = entry.getKey();
+ ConflictNode currentNode = entry.getValue();
+
+ if ((node instanceof StallSiteNode)
+ && (currentNode instanceof StallSiteNode)) {
+ continue;
+ }
+
+ if (currentNodeID.equals(node.getID())) {
+ continue;
+ }
+
+ Set<Set> currentNodeReachabilitySet = currentNode
+ .getReachabilitySet();
+
+ Set<GloballyUniqueTokenTuple> overlapSet = calculateOverlappedReachableRegion(
+ nodeReachabilitySet, currentNodeReachabilitySet);
+ if (overlapSet.size() > 0) {
+
+ // System.out.println("OVERLAPPED=" + overlapSet);
+
+ if (node instanceof StallSiteNode
+ && currentNode instanceof LiveInNode) {
+ int edgeType = decideConflictEdgeType(overlapSet,
+ (StallSiteNode) node, (LiveInNode) currentNode);
+ addConflictEdge(edgeType, node, currentNode);
+ } else if (node instanceof LiveInNode
+ && currentNode instanceof LiveInNode) {
+ int edgeType = decideConflictEdgeType(overlapSet,
+ (LiveInNode) node, (LiveInNode) currentNode);
+ addConflictEdge(edgeType, node, currentNode);
+ }
+
+ } else {
+ // System.out.println("DOSE NOT OVERLAPPED " + node + " <-> "
+ // + currentNode);
+ }
+ }
+ }
+
+ public boolean containsTokenTuple(Set<GloballyUniqueTokenTuple> overlapSet,
+ String uniqueID) {
+
+ for (Iterator iterator = overlapSet.iterator(); iterator.hasNext();) {
+ GloballyUniqueTokenTuple globallyUniqueTokenTuple = (GloballyUniqueTokenTuple) iterator
+ .next();
+ if (globallyUniqueTokenTuple.getID().equals(uniqueID)) {
+ return true;
+ }
+ }
+
+ return false;
+
+ }
+
+ private int decideConflictEdgeType(
+ Set<GloballyUniqueTokenTuple> overlapSet,
+ StallSiteNode stallSiteNode, LiveInNode liveInNode) {
+
+ Set<SESEEffectsKey> liveInWriteEffectSet = liveInNode
+ .getWriteEffectsSet();
+
+ if (liveInWriteEffectSet != null) {
+ for (Iterator iterator = liveInWriteEffectSet.iterator(); iterator
+ .hasNext();) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
+ .next();
+ String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+
+ if (containsTokenTuple(overlapSet, hrnUniqueID)) {
+ return ConflictEdge.COARSE_GRAIN_EDGE;
+ }
+ }
+ }
+
+ return ConflictEdge.FINE_GRAIN_EDGE;
+ }
+
+ private int decideConflictEdgeType(
+ Set<GloballyUniqueTokenTuple> overlapSet, LiveInNode liveInNodeA,
+ LiveInNode liveInNodeB) {
+
+ Set<SESEEffectsKey> liveInWriteEffectSetA = liveInNodeA
+ .getWriteEffectsSet();
+
+ if (liveInWriteEffectSetA != null) {
+ for (Iterator iterator = liveInWriteEffectSetA.iterator(); iterator
+ .hasNext();) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
+ .next();
+ String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+
+ if (containsTokenTuple(overlapSet, hrnUniqueID)) {
+ return ConflictEdge.COARSE_GRAIN_EDGE;
+ }
+ }
+ }
+
+ Set<SESEEffectsKey> liveInWriteEffectSetB = liveInNodeB
+ .getWriteEffectsSet();
+
+ if (liveInWriteEffectSetB != null) {
+ for (Iterator iterator = liveInWriteEffectSetB.iterator(); iterator
+ .hasNext();) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
+ .next();
+ String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+
+ if (containsTokenTuple(overlapSet, hrnUniqueID)) {
+ return ConflictEdge.COARSE_GRAIN_EDGE;
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ private Set<GloballyUniqueTokenTuple> calculateOverlappedReachableRegion(
+ Set<Set> setA, Set<Set> setB) {
+
+ Set<GloballyUniqueTokenTuple> returnSet = new HashSet<GloballyUniqueTokenTuple>();
+
+ for (Iterator iterator2 = setA.iterator(); iterator2.hasNext();) {
+ Set tokenTupleSetA = (Set) iterator2.next();
+
+ for (Iterator iterator3 = setB.iterator(); iterator3.hasNext();) {
+ Set tokenTupleSetB = (Set) iterator3.next();
+
+ if (tokenTupleSetA.equals(tokenTupleSetB)) {
+ // reachability states are overlapped
+ Iterator ttsIter = tokenTupleSetA.iterator();
+ while (ttsIter.hasNext()) {
+ GloballyUniqueTokenTuple tt = (GloballyUniqueTokenTuple) ttsIter
+ .next();
+ returnSet.add(tt);
+ }
+ }
+ }
+ }
+ return returnSet;
}
public String addStallNode(TempDescriptor td, FlatMethod fm,
- StallSite stallSite) {
+ StallSite stallSite, Set<Set> reachabilitySet) {
String stallNodeID = td + "_" + fm.getMethod().getSymbol();
- if (!td2cn.containsKey(stallNodeID)) {
+ if (!id2cn.containsKey(stallNodeID)) {
StallSiteNode newNode = new StallSiteNode(stallNodeID, td,
- stallSite);
- td2cn.put(stallNodeID, newNode);
+ stallSite, reachabilitySet);
+ id2cn.put(stallNodeID, newNode);
// it add new new stall node to conflict graph
return stallNodeID;
}
}
public StallSiteNode getStallNode(String stallNodeID) {
- ConflictNode node = td2cn.get(stallNodeID);
+ ConflictNode node = id2cn.get(stallNodeID);
if (node instanceof StallSiteNode) {
return (StallSiteNode) node;
} else {
public void addLiveInNode(TempDescriptor td, FlatSESEEnterNode fsen,
Set<SESEEffectsKey> readEffectsSet,
- Set<SESEEffectsKey> writeEffectsSet) {
+ Set<SESEEffectsKey> writeEffectsSet, Set<Set> reachabilitySet) {
String liveinNodeID = td + "_" + fsen.getIdentifier();
- LiveInNode newNode = new LiveInNode(liveinNodeID, td, readEffectsSet,
- writeEffectsSet);
- td2cn.put(liveinNodeID, newNode);
+ LiveInNode liveInNode = (LiveInNode) id2cn.get(liveinNodeID);
+ if (liveInNode != null) {
+ liveInNode.addReadEffectsSet(readEffectsSet);
+ liveInNode.addWriteEffectsSet(writeEffectsSet);
+ liveInNode.addReachabilitySet(reachabilitySet);
+ id2cn.put(liveinNodeID, liveInNode);
+ } else {
+ LiveInNode newNode = new LiveInNode(liveinNodeID, td,
+ readEffectsSet, writeEffectsSet, reachabilitySet);
+ id2cn.put(liveinNodeID, newNode);
+ }
+
+ }
+
+ public void addConflictEdge(int type, ConflictNode nodeU, ConflictNode nodeV) {
+
+ if (!nodeU.isConflictConnectedTo(nodeV)) {
+ ConflictEdge newEdge = new ConflictEdge(nodeU, nodeV, type);
+ nodeU.addEdge(newEdge);
+ nodeV.addEdge(newEdge);
+ }
}
public HashSet<LiveInNode> getLiveInNodeSet() {
HashSet<LiveInNode> resultSet = new HashSet<LiveInNode>();
- Set<String> keySet = td2cn.keySet();
+ Set<String> keySet = id2cn.keySet();
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
String key = (String) iterator.next();
- ConflictNode node = td2cn.get(key);
+ ConflictNode node = id2cn.get(key);
if (node instanceof LiveInNode) {
resultSet.add((LiveInNode) node);
HashSet<HeapRegionNode> visited = new HashSet<HeapRegionNode>();
// then visit every heap region node
- Set<Entry<String, ConflictNode>> s = td2cn.entrySet();
+ Set<Entry<String, ConflictNode>> s = id2cn.entrySet();
Iterator<Entry<String, ConflictNode>> i = s.iterator();
-
- HashSet<ConflictEdge> addedSet=new HashSet<ConflictEdge>();
-
+
+ HashSet<ConflictEdge> addedSet = new HashSet<ConflictEdge>();
+
while (i.hasNext()) {
Entry<String, ConflictNode> entry = i.next();
ConflictNode node = entry.getValue();
+
+ // if (node.getID().startsWith("___dst")
+ // || node.getID().startsWith("___srctmp")
+ // || node.getID().startsWith("___neverused")
+ // || node.getID().startsWith("___temp")) {
+ //
+ // continue;
+ // }
+
String attributes = "[";
attributes += "label=\"ID" + node.getID() + "\\n";
ConflictNode u = conflictEdge.getVertexU();
ConflictNode v = conflictEdge.getVertexV();
-
+
+ // String uID=u.getID();
+ // String vID=v.getID();
+ // if (uID.startsWith("___dst")
+ // || uID.startsWith("___srctmp")
+ // || uID.startsWith("___neverused")
+ // || uID.startsWith("___temp")
+ // || vID.startsWith("___dst")
+ // || vID.startsWith("___srctmp")
+ // || vID.startsWith("___neverused")
+ // || vID.startsWith("___temp")) {
+ // continue;
+ // }
+
if (conflictEdge.getType() == ConflictEdge.WRITE_CONFLICT) {
- if(!addedSet.contains(conflictEdge)){
+ if (!addedSet.contains(conflictEdge)) {
bw.write(" " + u.getID() + "--" + v.getID()
+ "[label=\""
+ conflictEdge.toGraphEdgeString()
private int type;
public static final int WRITE_CONFLICT = 0;
- public static final int REACH_CONFLICT = 1;
+ public static final int FINE_GRAIN_EDGE = 1;
+ public static final int COARSE_GRAIN_EDGE = 2;
public ConflictEdge(ConflictNode u, ConflictNode v, int type) {
this.u = u;
public String toGraphEdgeString() {
if (type == WRITE_CONFLICT) {
return "W_CONFLICT";
+ } else if (type == FINE_GRAIN_EDGE) {
+ return "F_CONFLICT";
} else {
- return "R_CONFLICT";
+ return "C_CONFLICT";
}
}
public ConflictNode getVertexV() {
return v;
}
-
- public int getType(){
+
+ public int getType() {
return type;
}
package Analysis.MLP;
import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import Analysis.OwnershipAnalysis.TokenTupleSet;
import IR.Flat.TempDescriptor;
public abstract class ConflictNode {
protected TempDescriptor td;
protected String id;
protected HashSet<ConflictEdge> edgeSet;
+ protected Set<Set> reachabilitySet;
public ConflictNode() {
edgeSet = new HashSet<ConflictEdge>();
return id;
}
+ public boolean isConflictConnectedTo(ConflictNode node) {
+
+ for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) {
+ ConflictEdge edge = (ConflictEdge) iterator.next();
+ if (edge.getType() != ConflictEdge.WRITE_CONFLICT) {
+ if (edge.getVertexU().equals(node)
+ || edge.getVertexV().equals(node)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public void addEdge(ConflictEdge edge) {
edgeSet.add(edge);
}
return edgeSet;
}
+ public Set<Set> getReachabilitySet() {
+ return reachabilitySet;
+ }
+
}
--- /dev/null
+package Analysis.MLP;
+
+import Analysis.OwnershipAnalysis.TokenTuple;
+
+public class GloballyUniqueTokenTuple {
+
+ private Integer token;
+ private boolean isMultiObject;
+ private int arity;
+ private String id;
+
+ public GloballyUniqueTokenTuple(String uniqueID, TokenTuple tt) {
+ this.id = uniqueID;
+ this.arity = tt.getArity();
+ this.token = tt.getToken();
+ this.isMultiObject = tt.isMultiObject();
+ }
+
+ public boolean isMultiObject() {
+ return isMultiObject;
+ }
+
+ public int getArity() {
+ return arity;
+ }
+
+ public int hashCode() {
+ return id.hashCode() + arity;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+
+ if (!(o instanceof GloballyUniqueTokenTuple)) {
+ return false;
+ }
+
+ GloballyUniqueTokenTuple tt = (GloballyUniqueTokenTuple) o;
+
+ return id.equals(tt.getID()) && arity == tt.getArity();
+ }
+
+ public String toString() {
+ String s = id;
+
+ if (isMultiObject) {
+ s += "M";
+ }
+
+ if (arity == TokenTuple.ARITY_ZEROORMORE) {
+ s += "*";
+ } else if (arity == TokenTuple.ARITY_ONEORMORE) {
+ s += "+";
+ }
+
+ return s;
+ }
+
+}
public LiveInNode(String id, TempDescriptor td,
Set<SESEEffectsKey> readEffectsSet,
- Set<SESEEffectsKey> writeEffectsSet) {
+ Set<SESEEffectsKey> writeEffectsSet, Set<Set> reachabilitySet) {
this.id = id;
this.td = td;
this.readEffectsSet = readEffectsSet;
this.writeEffectsSet = writeEffectsSet;
+ this.reachabilitySet = reachabilitySet;
+ }
+
+ public Set<SESEEffectsKey> getReadEffectsSet() {
+ return readEffectsSet;
+ }
+
+ public Set<SESEEffectsKey> getWriteEffectsSet() {
+ return writeEffectsSet;
+ }
+
+ public void addReadEffectsSet(Set<SESEEffectsKey> newReadEffectsSet) {
+ if (newReadEffectsSet != null) {
+ readEffectsSet.addAll(newReadEffectsSet);
+ }
+ }
+
+ public void addWriteEffectsSet(Set<SESEEffectsKey> newWriteEffectsSet) {
+ if (newWriteEffectsSet != null) {
+ writeEffectsSet.addAll(newWriteEffectsSet);
+ }
+ }
+
+ public void addReachabilitySet(Set<Set> newReachabilitySet) {
+ if (newReachabilitySet != null) {
+ reachabilitySet.addAll(newReachabilitySet);
+ }
}
public boolean isWriteConflictWith(StallSiteNode stallNode) {
return result;
}
+ public boolean equals(Object o) {
+
+ if (o == null) {
+ return false;
+ }
+
+ if (!(o instanceof LiveInNode)) {
+ return false;
+ }
+
+ LiveInNode in = (LiveInNode) o;
+
+ if (id.equals(in.id)) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
}
import Analysis.OwnershipAnalysis.ParameterDecomposition;
import Analysis.OwnershipAnalysis.ReachabilitySet;
import Analysis.OwnershipAnalysis.ReferenceEdge;
+import Analysis.OwnershipAnalysis.TokenTuple;
import Analysis.OwnershipAnalysis.TokenTupleSet;
import IR.Descriptor;
import IR.FieldDescriptor;
import IR.Flat.FlatCall;
import IR.Flat.FlatEdge;
import IR.Flat.FlatFieldNode;
+import IR.Flat.FlatLiteralNode;
import IR.Flat.FlatMethod;
import IR.Flat.FlatNew;
import IR.Flat.FlatNode;
return sorted;
}
-
+ /*
private void postSESEConflictsForward(JavaCallGraph javaCallGraph) {
// store the reachability set in stall site data structure
}
}
-
+ */
private void postConflicts_nodeAction(MethodContext mc, FlatNode fn,
ParentChildConflictsMap currentConflictsMap) {
// create conflict graph for each flat method
ConflictGraph conflictGraph = new ConflictGraph();
- Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
- flatNodesToVisit.add(fm);
-
- Set<FlatNode> visited = new HashSet<FlatNode>();
+ HashSet<MethodContext> mcSet = ownAnalysisForSESEConflicts
+ .getAllMethodContextSetByDescriptor(fm.getMethod());
+ Iterator<MethodContext> mcIter = mcSet.iterator();
- while (!flatNodesToVisit.isEmpty()) {
- Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
- FlatNode fn = fnItr.next();
+ while (mcIter.hasNext()) {
+ MethodContext mc = mcIter.next();
- flatNodesToVisit.remove(fn);
- visited.add(fn);
+ Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
+ flatNodesToVisit.add(fm);
- // ///////////////////////////////////////////////////////////////////////
- // Adding Stall Node of current program statement
- ParentChildConflictsMap currentConflictsMap = conflictsResults
- .get(fn);
+ Set<FlatNode> visited = new HashSet<FlatNode>();
- Hashtable<TempDescriptor, StallSite> stallMap = currentConflictsMap
- .getStallMap();
- Set<Entry<TempDescriptor, StallSite>> entrySet = stallMap
- .entrySet();
+ while (!flatNodesToVisit.isEmpty()) {
+ Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
+ FlatNode fn = fnItr.next();
- HashSet<String> newStallNodeSet = new HashSet<String>();
+ flatNodesToVisit.remove(fn);
+ visited.add(fn);
- for (Iterator<Entry<TempDescriptor, StallSite>> iterator2 = entrySet
- .iterator(); iterator2.hasNext();) {
- Entry<TempDescriptor, StallSite> entry = iterator2.next();
- TempDescriptor td = entry.getKey();
- StallSite stallSite = entry.getValue();
- String stallNodeID;
- if ((stallNodeID = conflictGraph
- .addStallNode(td, fm, stallSite)) != null) {
- // it added new stall node
- newStallNodeSet.add(stallNodeID);
+ // ///////////////////////////////////////////////////////////////////////
+ // Adding Stall Node of current program statement
+ ParentChildConflictsMap currentConflictsMap = conflictsResults
+ .get(fn);
+
+ Hashtable<TempDescriptor, StallSite> stallMap = currentConflictsMap
+ .getStallMap();
+ Set<Entry<TempDescriptor, StallSite>> entrySet = stallMap
+ .entrySet();
+
+ HashSet<String> newStallNodeSet = new HashSet<String>();
+
+ for (Iterator<Entry<TempDescriptor, StallSite>> iterator2 = entrySet
+ .iterator(); iterator2.hasNext();) {
+ Entry<TempDescriptor, StallSite> entry = iterator2.next();
+ TempDescriptor td = entry.getKey();
+ StallSite stallSite = entry.getValue();
+ String stallNodeID;
+
+ // reachability set
+ OwnershipGraph og = ownAnalysisForSESEConflicts
+ .getOwnvershipGraphByMethodContext(mc);
+ Set<Set> reachabilitySet = calculateReachabilitySet(og, td);
+
+ if ((stallNodeID = conflictGraph.addStallNode(td, fm,
+ stallSite, reachabilitySet)) != null) {
+ // it added new stall node
+ newStallNodeSet.add(stallNodeID);
+ }
}
- }
- // Analyzing write conflicts between stall site and live-in
- // variables
- for (Iterator iterator = newStallNodeSet.iterator(); iterator
- .hasNext();) {
- String stallNodeID = (String) iterator.next();
-
- StallSiteNode stallNode = conflictGraph
- .getStallNode(stallNodeID);
-
- if (stallNode != null) {
- // if prior sese blocks have write effects on this stall
- // node, it should be connected between them.
- HashSet<LiveInNode> liveInNodeSet = conflictGraph
- .getLiveInNodeSet();
- for (Iterator iterator2 = liveInNodeSet.iterator(); iterator2
- .hasNext();) {
- LiveInNode liveInNode = (LiveInNode) iterator2.next();
- if (liveInNode.isWriteConflictWith(stallNode)) {
- // create conflict edge
- conflictGraph.addWriteConflictEdge(stallNode, liveInNode);
+ // Analyzing write conflicts between stall site and live-in
+ // variables
+ for (Iterator iterator = newStallNodeSet.iterator(); iterator
+ .hasNext();) {
+ String stallNodeID = (String) iterator.next();
+
+ StallSiteNode stallNode = conflictGraph
+ .getStallNode(stallNodeID);
+
+ if (stallNode != null) {
+ // if prior sese blocks have write effects on this stall
+ // node, it should be connected between them.
+ HashSet<LiveInNode> liveInNodeSet = conflictGraph
+ .getLiveInNodeSet();
+ for (Iterator iterator2 = liveInNodeSet.iterator(); iterator2
+ .hasNext();) {
+ LiveInNode liveInNode = (LiveInNode) iterator2
+ .next();
+ if (liveInNode.isWriteConflictWith(stallNode)) {
+ // create conflict edge
+ conflictGraph.addWriteConflictEdge(stallNode,
+ liveInNode);
+ }
}
}
}
- }
- // ///////////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////////////
- conflictGraph_nodeAction(fm, fn, conflictGraph, currentConflictsMap);
+ conflictGraph_nodeAction(mc, fm, fn, conflictGraph,
+ currentConflictsMap);
- for (int i = 0; i < fn.numNext(); i++) {
- FlatNode nn = fn.getNext(i);
- if (!visited.contains(nn)) {
- flatNodesToVisit.add(nn);
+ for (int i = 0; i < fn.numNext(); i++) {
+ FlatNode nn = fn.getNext(i);
+ if (!visited.contains(nn)) {
+ flatNodesToVisit.add(nn);
+ }
}
- }
- }
+
+ } // end of while(flatNodesToVisit)
+
+ } // end of while(mcIter)
+
+ // decide fine-grain edge or coarse-grain edge among all vertexes
+ conflictGraph.analyzeConflicts();
conflictGraphResults.put(fm, conflictGraph);
}
- private void conflictGraph_nodeAction(FlatMethod fm, FlatNode fn,
- ConflictGraph graph, ParentChildConflictsMap currentConflictsMap) {
+ private Set<Set> calculateReachabilitySet(OwnershipGraph og, TempDescriptor tempDescriptor){
+ // reachability set
+ Set<Set> reachabilitySet = new HashSet();
+ LabelNode ln = og.td2ln.get(tempDescriptor);
+ Iterator<ReferenceEdge> refEdgeIter = ln
+ .iteratorToReferencees();
+ while (refEdgeIter.hasNext()) {
+ ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter
+ .next();
+ ReachabilitySet set = referenceEdge.getBeta();
+ Iterator<TokenTupleSet> ttsIter = set.iterator();
+ while (ttsIter.hasNext()) {
+ TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter
+ .next();
+
+ HashSet<GloballyUniqueTokenTuple> newTokenTupleSet = new HashSet<GloballyUniqueTokenTuple>();
+ // reachabilitySet.add(tokenTupleSet);
+
+ Iterator iter = tokenTupleSet.iterator();
+ while (iter.hasNext()) {
+ TokenTuple tt = (TokenTuple) iter.next();
+ int token = tt.getToken();
+ String uniqueID = og.id2hrn.get(
+ new Integer(token))
+ .getGloballyUniqueIdentifier();
+ GloballyUniqueTokenTuple gtt = new GloballyUniqueTokenTuple(
+ uniqueID, tt);
+ newTokenTupleSet.add(gtt);
+ }
+
+ reachabilitySet.add(newTokenTupleSet);
+ }
+ }
+ return reachabilitySet;
+ }
+
+ private void conflictGraph_nodeAction(MethodContext mc, FlatMethod fm, FlatNode fn,
+ ConflictGraph graph,
+ ParentChildConflictsMap currentConflictsMap) {
switch (fn.kind()) {
case FKind.FlatSESEEnterNode: {
FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
+ OwnershipGraph og = ownAnalysisForSESEConflicts
+ .getOwnvershipGraphByMethodContext(mc);
if (!fsen.getIsCallerSESEplaceholder()) {
Set<TempDescriptor> invar_set = fsen.getInVarSet();
- String liveinStr = "";
-
for (Iterator iterator = invar_set.iterator(); iterator
.hasNext();) {
TempDescriptor tempDescriptor = (TempDescriptor) iterator
.next();
-
+
+ // effects set
SESEEffectsSet seseEffectsSet = fsen.getSeseEffectsSet();
- Set<SESEEffectsKey> readEffectsSet=seseEffectsSet.getReadingSet(tempDescriptor);
- Set<SESEEffectsKey> writeEffectsSet=seseEffectsSet.getWritingSet(tempDescriptor);
-
- graph.addLiveInNode(tempDescriptor,fsen,readEffectsSet,writeEffectsSet);
+ Set<SESEEffectsKey> readEffectsSet = seseEffectsSet
+ .getReadingSet(tempDescriptor);
+ Set<SESEEffectsKey> writeEffectsSet = seseEffectsSet
+ .getWritingSet(tempDescriptor);
+
+ Set<Set> reachabilitySet=calculateReachabilitySet(og,tempDescriptor);
+
+ // add new live-in node
+ graph.addLiveInNode(tempDescriptor, fsen, readEffectsSet,
+ writeEffectsSet, reachabilitySet);
+
}
}
-
+
}
break;
}
}
- }else{
- System.out.println("src is accessible="+possibleSrc);
}
+// else{
+// System.out.println("src is accessible="+possibleSrc);
+// }
currentConflictsMap.addAccessibleVar(possibleSrc);
}
break;
+ /* do we need this case?
+ case FKind.FlatLiteralNode: {
+
+ if (currentConflictsMap.isAfterChildSESE()) {
+ FlatLiteralNode fln = (FlatLiteralNode) fn;
+ TempDescriptor dst = fln.getDst();
+ currentConflictsMap.addAccessibleVar(dst);
+ }
+
+ } break;
+ */
+
case FKind.FlatReturnNode: {
FlatReturnNode frn = (FlatReturnNode) fn;
package Analysis.MLP;
import java.util.HashSet;
+import java.util.Set;
import Analysis.OwnershipAnalysis.HeapRegionNode;
+import Analysis.OwnershipAnalysis.TokenTupleSet;
import IR.Flat.TempDescriptor;
public class StallSiteNode extends ConflictNode {
protected StallSite stallSite;
- public StallSiteNode(String id, TempDescriptor td, StallSite stallSite) {
+ public StallSiteNode(String id, TempDescriptor td, StallSite stallSite,
+ Set<Set> reachabilitySet) {
this.id = id;
this.td = td;
this.stallSite = stallSite;
+ this.reachabilitySet = reachabilitySet;
}
-
- public HashSet<HeapRegionNode> getHRNSet(){
+
+ public HashSet<HeapRegionNode> getHRNSet() {
return stallSite.getHRNSet();
}
-
- public StallSite getStallSite(){
+
+ public StallSite getStallSite() {
return stallSite;
}