From: bdemsky Date: Fri, 18 Mar 2011 00:01:17 +0000 (+0000) Subject: my changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b189ea12f9271f9c9b69fa443909c4db54b54788;p=IRC.git my changes --- diff --git a/Robust/src/Analysis/Disjoint/Canonical.java b/Robust/src/Analysis/Disjoint/Canonical.java index 44377080..71d1f125 100644 --- a/Robust/src/Analysis/Disjoint/Canonical.java +++ b/Robust/src/Analysis/Disjoint/Canonical.java @@ -1480,6 +1480,36 @@ abstract public class Canonical { return out; } + // BOO, HISS! SESE (rblock) operand does NOT extend + // Canonical, so we can't cache this op by its + // canonical arguments--THINK ABOUT A BETTER WAY! + public static TaintSet removeSESETaints( TaintSet ts, + Set seseSet ) { + assert ts != null; + assert ts.isCanonical(); + + // NEVER a cached result... (cry) + TaintSet out = new TaintSet(); + + Iterator tItr = ts.iterator(); + while( tItr.hasNext() ) { + Taint t = tItr.next(); + + // what is allowed through? stall site taints always + // go through, anything where rblock doesn't match is + // unaffected, and if the taint has a non-empty predicate + // it is out of context so it should go through, too + if( t.getSESE() == null || + seseSet.contains(t)) { + out.taints.add( t ); + } + } + + out = (TaintSet) makeCanonical( out ); + //op2result.put( op, out ); CRY CRY + return out; + } + public static TaintSet removeInContextTaintsNP( TaintSet ts, FlatSESEEnterNode sese ) { assert ts != null; diff --git a/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java b/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java index 10786f8e..bf8ea0fa 100644 --- a/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java +++ b/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java @@ -89,6 +89,10 @@ public class RBlockRelationAnalysis { // node it will be in this set protected Hashtable< FlatNode, Set > fn2currentSESEs; + // if you want to know which rblocks might be executing a given flat + // node it will be in this set + protected Hashtable< FlatNode, Set > fn2allSESEs; + // if you want to know the method-local, inner-most nested task that // is executing a flat node, it is either here or null. // @@ -131,6 +135,33 @@ public class RBlockRelationAnalysis { return out; } + /* Returns all SESE's that this fn can be a member of + * transitively. */ + + public Set getTransitiveExecutingRBlocks(FlatNode fn) { + if (fn2allSESEs.containsKey(fn)) + return fn2allSESEs.get(fn); + + //Compute and memoize result + HashSet seseSet=new HashSet(); + fn2allSESEs.put(fn, seseSet); + Stack toprocess=new Stack(); + toprocess.add(fn); + while(!toprocess.isEmpty()) { + FlatNode curr=toprocess.pop(); + Set callers=fn2currentSESEs.get(curr); + if (callers!=null) { + for(FlatSESEEnterNode sese:callers) { + if (!seseSet.contains(sese)) { + seseSet.add(sese); + toprocess.add(fn); + } + } + } + } + return seseSet; + } + public Set getPossibleExecutingRBlocks( FlatNode fn ) { Set out = fn2currentSESEs.get( fn ); if( out == null ) { @@ -179,6 +210,7 @@ public class RBlockRelationAnalysis { fn2currentSESEs = new Hashtable>(); fn2localInnerSESE = new Hashtable(); fn2isPotentialStallSite = new Hashtable(); + fn2allSESEs = new Hashtable< FlatNode, Set>(); MethodDescriptor mdSourceEntry = typeUtil.getMain(); @@ -405,8 +437,6 @@ public class RBlockRelationAnalysis { return hasChildrenByCall; } - - protected void findPossibleExecutingRBlocksAndStallSites() { for( Iterator fsenItr = allSESEs.iterator(); fsenItr.hasNext(); ) { FlatSESEEnterNode fsen = fsenItr.next(); @@ -479,7 +509,7 @@ public class RBlockRelationAnalysis { // your own exit, because one instance can // recursively invoke another addPossibleExecutingRBlock( child.getFlatExit(), fsen ); - + continue; } diff --git a/Robust/src/Analysis/Pointer/Edge.java b/Robust/src/Analysis/Pointer/Edge.java index ee5bba80..4100d500 100644 --- a/Robust/src/Analysis/Pointer/Edge.java +++ b/Robust/src/Analysis/Pointer/Edge.java @@ -2,9 +2,11 @@ package Analysis.Pointer; import IR.Flat.*; import IR.*; import Analysis.Pointer.AllocFactory.AllocNode; +import Analysis.Disjoint.Canonical; import Analysis.Disjoint.Taint; import Analysis.Disjoint.TaintSet; import Analysis.Pointer.MySet; +import java.util.*; public class Edge { FieldDescriptor fd; @@ -81,6 +83,11 @@ public class Edge { return newe; } + public void taintModify(Set seseSet) { + if (taints!=null) + taints=Canonical.removeSESETaints(taints, seseSet); + } + public TaintSet getTaints() { return taints; } @@ -106,7 +113,7 @@ public class Edge { public Edge changeSrcVar(TempDescriptor tmp, TaintSet taintset) { Edge e=new Edge(); e.fd=fd; - e.srcvar=srcvar; + e.srcvar=tmp; e.dst=dst; e.statuspredicate=NEW; if (taints==null) @@ -172,11 +179,6 @@ public class Edge { return e; } - public boolean statusDominates(Edge other) { - return (statuspredicate==NEW)|| - ((other.statuspredicate|statuspredicate)==statuspredicate); - } - public Edge makeStatus(AllocFactory factory) { Edge e=new Edge(); e.fd=fd; @@ -186,7 +188,22 @@ public class Edge { } public boolean subsumes(Edge e) { - return subsumes(this.statuspredicate, e.statuspredicate); + return subsumes(this.statuspredicate, e.statuspredicate)&&subsumes(this.taints, e.taints); + } + + public static boolean subsumes(TaintSet ts1, TaintSet ts2) { + if (ts2==null) + return true; + if (ts1==null) { + if (ts2.isEmpty()) + return true; + else + return false; + } + //Neither is null + //Do a set comparison + + return ts1.getTaints().containsAll(ts2.getTaints()); } public static boolean subsumes(int status1, int status2) { diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index a274ad67..932c4b9a 100644 --- a/Robust/src/Analysis/Pointer/Pointer.java +++ b/Robust/src/Analysis/Pointer/Pointer.java @@ -1017,6 +1017,7 @@ public class Pointer { Graph oldgraph=(ppoint.getIndex()==0)? bbgraphMap.get(bblock): graphMap.get(nodes.get(ppoint.getIndex()-1)); + Set seseCallers=OoOJava?taskAnalysis.getTransitiveExecutingRBlocks(fcall):null; //Age outside nodes if necessary for(Iterator nodeit=delta.addNodeAges.iterator();nodeit.hasNext();) { @@ -1047,6 +1048,8 @@ public class Pointer { edgetoadd=origEdgeKey; } } + if (seseCallers!=null) + edgetoadd.taintModify(seseCallers); mergeCallEdge(graph, newDelta, edgetoadd); } } @@ -1060,6 +1063,8 @@ public class Pointer { for(Edge e:returnedge) { Edge newedge=e.copy(); newedge.srcvar=fcall.getReturnTemp(); + if (seseCallers!=null) + newedge.taintModify(seseCallers); if (graph.getEdges(fcall.getReturnTemp())==null||!graph.getEdges(fcall.getReturnTemp()).contains(newedge)) newDelta.addEdge(newedge); }