From: bdemsky Date: Thu, 24 Mar 2011 22:24:00 +0000 (+0000) Subject: add lookup tables for effects X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d71fbfc70b1f94d04f8c1df26763537fea133d73;p=IRC.git add lookup tables for effects --- diff --git a/Robust/src/Analysis/OoOJava/ConflictGraph.java b/Robust/src/Analysis/OoOJava/ConflictGraph.java index 0eeb4549..ac14cf4c 100644 --- a/Robust/src/Analysis/OoOJava/ConflictGraph.java +++ b/Robust/src/Analysis/OoOJava/ConflictGraph.java @@ -12,6 +12,7 @@ import java.util.Set; import java.util.Map.Entry; import IR.State; +import Util.Pair; import Analysis.Disjoint.Alloc; import Analysis.Disjoint.AllocSite; import Analysis.Disjoint.DisjointAnalysis; @@ -22,11 +23,14 @@ import IR.Flat.FlatNew; import IR.Flat.FlatNode; import IR.Flat.FlatSESEEnterNode; import IR.Flat.TempDescriptor; +import IR.FieldDescriptor; public class ConflictGraph { protected Hashtable id2cn; protected Hashtable>> sese2te; + protected HashMap, Integer> seseEffects; + protected HashMap, Integer> stallEffects; protected DisjointAnalysis da; protected FlatMethod fmEnclosing; @@ -41,6 +45,16 @@ public class ConflictGraph { this.state=state; id2cn = new Hashtable(); sese2te = new Hashtable>>(); + seseEffects = new HashMap, Integer>(); + stallEffects = new HashMap, Integer>(); + } + + public int getStallEffects(Alloc affectedNode, FieldDescriptor fd) { + return stallEffects.get(new Pair(affectedNode, fd)).intValue(); + } + + public int getSESEEffects(Alloc affectedNode, FieldDescriptor fd) { + return seseEffects.get(new Pair(affectedNode, fd)).intValue(); } public void setDisJointAnalysis(DisjointAnalysis da) { @@ -103,8 +117,14 @@ public class ConflictGraph { } node.addEffect(as, e); node.addTaint(t); - id2cn.put(id, node); + + Pair p=new Pair(e.getAffectedAllocSite(), e.getField()); + int type=e.getType(); + if (!stallEffects.containsKey(p)) + stallEffects.put(p, new Integer(type)); + else + stallEffects.put(p, new Integer(type|stallEffects.get(p).intValue())); } public void addLiveInNodeEffect(Taint t, Effect e) { @@ -122,6 +142,13 @@ public class ConflictGraph { node.addTaint(t); id2cn.put(id, node); + + Pair p=new Pair(e.getAffectedAllocSite(), e.getField()); + int type=e.getType(); + if (!seseEffects.containsKey(p)) + seseEffects.put(p, new Integer(type)); + else + seseEffects.put(p, new Integer(type|seseEffects.get(p).intValue())); } public void addConflictEdge(int type, ConflictNode nodeU, ConflictNode nodeV) { diff --git a/Robust/src/Util/Pair.java b/Robust/src/Util/Pair.java index 061804f4..367411db 100644 --- a/Robust/src/Util/Pair.java +++ b/Robust/src/Util/Pair.java @@ -14,12 +14,16 @@ public class Pair { return b; } public int hashCode() { - return a.hashCode()*31+b.hashCode(); + if (b!=null) + return a.hashCode()*31+b.hashCode(); + else + return a.hashCode(); } public boolean equals(Object o) { if (!(o instanceof Pair)) return false; Pair t=(Pair)o; - return a.equals(t.a)&&b.equals(t.b); + return a.equals(t.a)&&(((b!=null)&&(t.b!=null)&&b.equals(t.b))|| + ((b==null)&&(t.b==null))); } } \ No newline at end of file