import Analysis.Pointer.AllocFactory.AllocNode;
import java.util.*;
import Analysis.Disjoint.TaintSet;
+import Analysis.Disjoint.Taint;
public class GraphManip {
static MySet<Edge> genEdges(TempDescriptor tmp, HashSet<AllocNode> dstSet) {
return edgeset;
}
- static MySet<Edge> dereference(Graph graph, Delta delta, TempDescriptor dst, MySet<Edge> srcEdges, FieldDescriptor fd, FlatNode fn) {
+ static MySet<Edge> dereference(Graph graph, Delta delta, TempDescriptor dst, MySet<Edge> srcEdges, FieldDescriptor fd, FlatNode fn, TaintSet taint) {
MySet<Edge> edgeset=new MySet<Edge>();
for(Edge edge:srcEdges) {
TaintSet ts=edge.getTaints();
- if (ts!=null)
- ts=ts.reTaint(fn);
+ if (ts!=null) {
+ ts=ts.reTaint(fn);
+ if (taint!=null)
+ ts=ts.merge(taint);
+ } else {
+ ts=taint;
+ }
MySet<Edge> removeedges=delta.heapedgeremove.get(edge.dst);
for(Edge e:graph.getEdges(edge.dst)) {
if (e.fd==fd&&(removeedges==null||!removeedges.contains(e))) {
return edgeset;
}
- static MySet<Edge> diffDereference(Delta delta, TempDescriptor dst, MySet<Edge> srcEdges, FieldDescriptor fd, FlatNode fn) {
+ static MySet<Edge> diffDereference(Delta delta, TempDescriptor dst, MySet<Edge> srcEdges, FieldDescriptor fd, FlatNode fn, TaintSet taint) {
MySet<Edge> edgeset=new MySet<Edge>();
for(Edge edge:srcEdges) {
TaintSet ts=edge.getTaints();
- if (ts!=null)
- ts=ts.reTaint(fn);
+ if (ts!=null) {
+ if (taint!=null)
+ ts=ts.merge(taint);
+ ts=ts.reTaint(fn);
+ } else
+ ts=taint;
MySet<Edge> removeedges=delta.heapedgeremove.get(edge.dst);
if (delta.baseheapedge.containsKey(edge.dst)) {
for(Edge e:delta.baseheapedge.get(edge.dst)) {
import Analysis.Disjoint.TaintSet;
import Analysis.Disjoint.Canonical;
import Analysis.CallGraph.CallGraph;
+import Analysis.OoOJava.RBlockRelationAnalysis;
import java.io.*;
+
public class Pointer {
HashMap<FlatMethod, BasicBlock> blockMap;
HashMap<BBlock, Graph> bbgraphMap;
AllocFactory allocFactory;
LinkedList<Delta> toprocess;
TempDescriptor returntmp;
+ RBlockRelationAnalysis taskAnalysis;
- public Pointer(State state, TypeUtil typeUtil, CallGraph callGraph) {
+ public Pointer(State state, TypeUtil typeUtil, CallGraph callGraph, RBlockRelationAnalysis taskAnalysis) {
this(state, typeUtil);
this.callGraph=callGraph;
+ this.OoOJava=true;
+ this.taskAnalysis=taskAnalysis;
}
public Pointer(State state, TypeUtil typeUtil) {
TempDescriptor src;
FieldDescriptor fd;
TempDescriptor dst;
+ TaintSet taint=null;
+
if (node.kind()==FKind.FlatElementNode) {
FlatElementNode fen=(FlatElementNode) node;
src=fen.getSrc();
fd=ffn.getField();
dst=ffn.getDst();
}
+ if (OoOJava&&taskAnalysis.isPotentialStallSite(node)) {
+ taint=TaintSet.factory(Taint.factory(node, src, null, null, null));
+ }
+
//Do nothing for non pointers
if (!dst.getType().isPtr())
return delta;
if (delta.getInit()) {
MySet<Edge> srcedges=GraphManip.getEdges(graph, delta, src);
- MySet<Edge> edgesToAdd=GraphManip.dereference(graph, delta, dst, srcedges, fd, node);
+ MySet<Edge> edgesToAdd=GraphManip.dereference(graph, delta, dst, srcedges, fd, node, taint);
MySet<Edge> edgesToRemove=GraphManip.getEdges(graph, delta, dst);
updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);
applyDiffs(graph, delta);
} else {
/* First compute new objects we read fields of */
MySet<Edge> allsrcedges=GraphManip.getEdges(graph, delta, src);
- MySet<Edge> edgesToAdd=GraphManip.diffDereference(delta, dst, allsrcedges, fd, node);
+ MySet<Edge> edgesToAdd=GraphManip.diffDereference(delta, dst, allsrcedges, fd, node, taint);
/* Next compute new targets of fields */
MySet<Edge> newsrcedges=GraphManip.getDiffEdges(delta, src);
- MySet<Edge> newfdedges=GraphManip.dereference(graph, delta, dst, newsrcedges, fd, node);
+ MySet<Edge> newfdedges=GraphManip.dereference(graph, delta, dst, newsrcedges, fd, node, taint);
/* Compute the union, and then the set of edges */
Edge.mergeEdgesInto(edgesToAdd, newfdedges);