From: bdemsky Date: Tue, 25 Jan 2011 09:11:59 +0000 (+0000) Subject: more changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9f6576080dd17f8675251d5047333d3cea411fed;p=IRC.git more changes --- diff --git a/Robust/src/Analysis/Pointer/Graph.java b/Robust/src/Analysis/Pointer/Graph.java index 6f01836a..9b801573 100644 --- a/Robust/src/Analysis/Pointer/Graph.java +++ b/Robust/src/Analysis/Pointer/Graph.java @@ -21,6 +21,14 @@ public class Graph { this.parent=parent; } + public HashSet getEdges(TempDescriptor tmp) { + if (varMap.containsKey(tmp)) + return varMap.get(tmp); + else if (parent!=null&&parent.varMap.containsKey(tmp)) + return parent.varMap.get(tmp); + else return emptySet; + } + public HashSet getEdges(AllocNode node) { if (nodeMap.containsKey(node)) return nodeMap.get(node); diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index d11827ab..cd474145 100644 --- a/Robust/src/Analysis/Pointer/Pointer.java +++ b/Robust/src/Analysis/Pointer/Pointer.java @@ -74,8 +74,9 @@ public class Pointer { switch(node.kind()) { case FKind.FlatNew: return processNewNode((FlatNew)node, delta, newgraph); - case FKind.FlatCall: case FKind.FlatFieldNode: + return processFieldNode((FlatFieldNode)node, delta, newgraph); + case FKind.FlatCall: case FKind.FlatSetFieldNode: case FKind.FlatReturnNode: case FKind.FlatElementNode: @@ -154,6 +155,36 @@ public class Pointer { } } + HashSet getTemps(Graph graph, Delta delta, TempDescriptor tmp) { + HashSet nodes=new HashSet(); + HashSet removeedges=delta.varedgeremove.get(tmp); + + for(Edge e:graph.getEdges(tmp)) { + if (removeedges==null||!removeedges.contains(e)) + nodes.add(e.dst); + } + if (delta.varedgeadd.containsKey(tmp)) + for(Edge e:delta.varedgeadd.get(tmp)) { + nodes.add(e.dst); + } + return nodes; + } + + Delta processFieldNode(FlatFieldNode node, Delta delta, Graph graph) { + TempDescriptor src=node.getSrc(); + FieldDescriptor fd=node.getField(); + TempDescriptor dst=node.getDst(); + if (delta.getInit()) { + HashSet nodes=getTemps(graph, delta, src); + + + applyDiffs(graph, delta); + } else { + + } + return delta; + } + Delta processNewNode(FlatNew node, Delta delta, Graph graph) { AllocNode summary=allocFactory.getAllocNode(node, true); AllocNode single=allocFactory.getAllocNode(node, false); @@ -168,7 +199,7 @@ public class Pointer { //Add it into the diffs delta.varedgeadd.put(tmp, newedges); //Remove the old edges - delta.varedgeremove.put(tmp, delta.basevaredge.get(tmp)); + delta.varedgeremove.put(tmp, graph.getEdges(tmp)); //Apply incoming diffs to graph applyDiffs(graph, delta); } else {