From e7992f967b2b7aa11ecfdcc5b9de0905057cae5a Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 25 Feb 2011 00:22:36 +0000 Subject: [PATCH] changes --- Robust/src/Analysis/Pointer/AllocFactory.java | 4 + Robust/src/Analysis/Pointer/Delta.java | 65 ++- Robust/src/Analysis/Pointer/Edge.java | 39 ++ Robust/src/Analysis/Pointer/Graph.java | 29 +- Robust/src/Analysis/Pointer/GraphManip.java | 74 +++- Robust/src/Analysis/Pointer/Pointer.java | 417 +++++++++++++----- Robust/src/Analysis/Pointer/Util.java | 8 +- Robust/src/IR/ClassDescriptor.java | 20 + 8 files changed, 506 insertions(+), 150 deletions(-) diff --git a/Robust/src/Analysis/Pointer/AllocFactory.java b/Robust/src/Analysis/Pointer/AllocFactory.java index 3ef8e8f7..67f426ed 100644 --- a/Robust/src/Analysis/Pointer/AllocFactory.java +++ b/Robust/src/Analysis/Pointer/AllocFactory.java @@ -16,6 +16,10 @@ public class AllocFactory { this.type=type; } + public TypeDescriptor getType() { + return type; + } + public boolean isSummary() { return summary; } diff --git a/Robust/src/Analysis/Pointer/Delta.java b/Robust/src/Analysis/Pointer/Delta.java index a0a49c72..2616e5c8 100644 --- a/Robust/src/Analysis/Pointer/Delta.java +++ b/Robust/src/Analysis/Pointer/Delta.java @@ -5,12 +5,13 @@ import Analysis.Pointer.BasicBlock.BBlock; import IR.Flat.*; public class Delta { - HashMap> heapedgeremove; - HashMap> heapedgeadd; - HashMap> varedgeadd; - HashMap> varedgeremove; - HashMap> baseheapedge; - HashMap> basevaredge; + HashMap> heapedgeremove; + HashMap> heapedgeadd; + HashMap> varedgeadd; + HashMap> varedgeremove; + HashMap> baseheapedge; + HashMap> basevaredge; + HashMap addNodeAges; boolean init; BBlock block; @@ -20,12 +21,13 @@ public class Delta { public Delta(BBlock block, boolean init) { this.init=init; - this.baseheapedge=new HashMap>(); - this.basevaredge=new HashMap>(); - this.heapedgeadd=new HashMap>(); - this.heapedgeremove=new HashMap>(); - this.varedgeadd=new HashMap>(); - this.varedgeremove=new HashMap>(); + this.baseheapedge=new HashMap>(); + this.basevaredge=new HashMap>(); + this.heapedgeadd=new HashMap>(); + this.heapedgeremove=new HashMap>(); + this.varedgeadd=new HashMap>(); + this.varedgeremove=new HashMap>(); + this.addNodeAges=new HashMap(); this.block=block; } @@ -40,6 +42,45 @@ public class Delta { this.block=block; } + public Delta changeParams(HashMap tmpMap, BBlock bblock) { + Delta newdelta=new Delta(); + newdelta.baseheapedge=baseheapedge; + newdelta.basevaredge=basevaredge; + newdelta.heapedgeadd=heapedgeadd; + newdelta.heapedgeremove=heapedgeremove; + //Update variable edge mappings + newdelta.varedgeadd=new HashMap>(); + for(Map.Entry> entry:varedgeadd.entrySet()) { + varedgeadd.put(tmpMap.get(entry.getKey()), entry.getValue()); + } + newdelta.varedgeremove=varedgeremove; + newdelta.block=bblock; + return newdelta; + } + + public Delta buildBase(MySet edges) { + Delta newdelta=new Delta(); + newdelta.baseheapedge=baseheapedge; + newdelta.basevaredge=basevaredge; + newdelta.heapedgeadd=heapedgeadd; + newdelta.heapedgeremove=heapedgeremove; + newdelta.varedgeadd=varedgeadd; + for(Edge e:edges) { + if (e.srcvar!=null) { + if (!newdelta.varedgeadd.containsKey(e.srcvar)) { + newdelta.varedgeadd.put(e.srcvar, new MySet()); + } + newdelta.varedgeadd.get(e.srcvar).add(e); + } else { + if (!newdelta.heapedgeadd.containsKey(e.src)) { + newdelta.heapedgeadd.put(e.src, new MySet()); + } + newdelta.heapedgeadd.get(e.src).add(e); + } + } + return newdelta; + } + public Delta diffBlock(BBlock bblock) { Delta newdelta=new Delta(); newdelta.baseheapedge=baseheapedge; diff --git a/Robust/src/Analysis/Pointer/Edge.java b/Robust/src/Analysis/Pointer/Edge.java index 54a9c048..41d79bb0 100644 --- a/Robust/src/Analysis/Pointer/Edge.java +++ b/Robust/src/Analysis/Pointer/Edge.java @@ -8,6 +8,17 @@ public class Edge { AllocNode src; TempDescriptor srcvar; AllocNode dst; + int statuspredicate; + public static final int SNGSNG=1; + public static final int SNGSUM=2; + public static final int SUMSNG=4; + public static final int SUMSUM=8; + public static final int NEW=16; + + public static int mergeStatus(int stat1, int stat2) { + int status=stat1|stat2; + return ((status&NEW)==NEW)?NEW:status; + } private Edge() { } @@ -17,6 +28,13 @@ public class Edge { this.fd=fd; this.dst=dst; } + + public Edge(AllocNode src, FieldDescriptor fd, AllocNode dst, int statuspredicate) { + this.src=src; + this.fd=fd; + this.dst=dst; + this.statuspredicate=statuspredicate; + } public Edge(TempDescriptor tmp, AllocNode dst) { this.srcvar=tmp; @@ -54,6 +72,27 @@ public class Edge { e.src=src; e.srcvar=srcvar; e.dst=dst; + e.statuspredicate=statuspredicate; + return e; + } + + public boolean statusDominates(Edge other) { + return (statuspredicate==NEW)|| + ((other.statuspredicate|statuspredicate)==statuspredicate); + } + + public Edge makeOld() { + Edge e=new Edge(); + e.fd=fd; + e.src=src; + e.srcvar=srcvar; + e.dst=dst; + int val=1; + if (dst.isSummary()) + val=val<<1; + if (src.isSummary()) + val=val<<2; + e.statuspredicate=val; return e; } } \ No newline at end of file diff --git a/Robust/src/Analysis/Pointer/Graph.java b/Robust/src/Analysis/Pointer/Graph.java index a835e911..7d61e985 100644 --- a/Robust/src/Analysis/Pointer/Graph.java +++ b/Robust/src/Analysis/Pointer/Graph.java @@ -9,19 +9,28 @@ public class Graph { * graph. */ Graph parent; - HashMap> nodeMap; - HashMap> varMap; - HashMap> backMap; - HashSet strongUpdateSet; + HashMap> nodeMap; + HashMap> varMap; + HashMap> backMap; + MySet strongUpdateSet; + MySet reachEdge; + HashSet reachNode; + + /* Need this information for mapping in callee results */ + HashMap nodeAges; + public static final Integer OLD=new Integer(1); + public static final Integer NEW=new Integer(2); + public static final Integer EITHER=new Integer(3); public Graph(Graph parent) { - nodeMap=new HashMap>(); - backMap=new HashMap>(); - varMap=new HashMap>(); + nodeMap=new HashMap>(); + backMap=new HashMap>(); + varMap=new HashMap>(); + nodeAges=new HashMap(); this.parent=parent; } - public HashSet getEdges(TempDescriptor tmp) { + public MySet getEdges(TempDescriptor tmp) { if (varMap.containsKey(tmp)) return varMap.get(tmp); else if (parent!=null&&parent.varMap.containsKey(tmp)) @@ -29,7 +38,7 @@ public class Graph { else return emptySet; } - public HashSet getEdges(AllocNode node) { + public MySet getEdges(AllocNode node) { if (nodeMap.containsKey(node)) return nodeMap.get(node); else if (parent!=null&&parent.nodeMap.containsKey(node)) @@ -37,5 +46,5 @@ public class Graph { else return emptySet; } - public static HashSet emptySet=new HashSet(); + public static MySet emptySet=new MySet(); } \ No newline at end of file diff --git a/Robust/src/Analysis/Pointer/GraphManip.java b/Robust/src/Analysis/Pointer/GraphManip.java index 5a74f7b4..a899fc5b 100644 --- a/Robust/src/Analysis/Pointer/GraphManip.java +++ b/Robust/src/Analysis/Pointer/GraphManip.java @@ -5,27 +5,27 @@ import Analysis.Pointer.AllocFactory.AllocNode; import java.util.*; public class GraphManip { - static HashSet genEdges(TempDescriptor tmp, HashSet dstSet) { - HashSet edgeset=new HashSet(); + static MySet genEdges(TempDescriptor tmp, HashSet dstSet) { + MySet edgeset=new MySet(); for(AllocNode node:dstSet) { edgeset.add(new Edge(tmp, node)); } return edgeset; } - static HashSet genEdges(HashSet srcSet, FieldDescriptor fd, HashSet dstSet) { - HashSet edgeset=new HashSet(); + static MySet genEdges(HashSet srcSet, FieldDescriptor fd, HashSet dstSet) { + MySet edgeset=new MySet(); for(AllocNode srcnode:srcSet) { for(AllocNode dstnode:dstSet) { - edgeset.add(new Edge(srcnode, fd, dstnode)); + edgeset.add(new Edge(srcnode, fd, dstnode, Edge.NEW)); } } return edgeset; } - static HashSet getDiffEdges(Delta delta, TempDescriptor tmp) { - HashSet edges=new HashSet(); - HashSet removeedges=delta.varedgeremove.get(tmp); + static MySet getDiffEdges(Delta delta, TempDescriptor tmp) { + MySet edges=new MySet(); + MySet removeedges=delta.varedgeremove.get(tmp); for(Edge e:delta.basevaredge.get(tmp)) { if (removeedges==null||!removeedges.contains(e)) @@ -38,9 +38,9 @@ public class GraphManip { return edges; } - static HashSet getEdges(Graph graph, Delta delta, TempDescriptor tmp) { - HashSet edges=new HashSet(); - HashSet removeedges=delta.varedgeremove.get(tmp); + static MySet getEdges(Graph graph, Delta delta, TempDescriptor tmp) { + MySet edges=new MySet(); + MySet removeedges=delta.varedgeremove.get(tmp); for(Edge e:graph.getEdges(tmp)) { if (removeedges==null||!removeedges.contains(e)) @@ -53,10 +53,10 @@ public class GraphManip { return edges; } - static HashSet getEdges(Graph graph, Delta delta, HashSet srcNodes, FieldDescriptor fd) { - HashSet nodes=new HashSet(); + static MySet getEdges(Graph graph, Delta delta, HashSet srcNodes, FieldDescriptor fd) { + MySet nodes=new MySet(); for(AllocNode node:srcNodes) { - HashSet removeedges=delta.heapedgeremove.get(node); + MySet removeedges=delta.heapedgeremove.get(node); for(Edge e:graph.getEdges(node)) { if (e.fd==fd&&(removeedges==null||!removeedges.contains(e))) nodes.add(e); @@ -70,9 +70,9 @@ public class GraphManip { return nodes; } - static HashSet getEdges(Graph graph, Delta delta, AllocNode node) { - HashSet nodes=new HashSet(); - HashSet removeedges=delta.heapedgeremove.get(node); + static MySet getEdges(Graph graph, Delta delta, AllocNode node) { + MySet nodes=new MySet(); + MySet removeedges=delta.heapedgeremove.get(node); for(Edge e:graph.getEdges(node)) { if ((removeedges==null||!removeedges.contains(e))) nodes.add(e); @@ -87,7 +87,7 @@ public class GraphManip { static HashSet getDiffNodes(Delta delta, TempDescriptor tmp) { HashSet nodes=new HashSet(); - HashSet removeedges=delta.varedgeremove.get(tmp); + MySet removeedges=delta.varedgeremove.get(tmp); for(Edge e:delta.basevaredge.get(tmp)) { if (removeedges==null||!removeedges.contains(e)) @@ -102,7 +102,7 @@ public class GraphManip { static HashSet getNodes(Graph graph, Delta delta, TempDescriptor tmp) { HashSet nodes=new HashSet(); - HashSet removeedges=delta.varedgeremove.get(tmp); + MySet removeedges=delta.varedgeremove.get(tmp); for(Edge e:graph.getEdges(tmp)) { if (removeedges==null||!removeedges.contains(e)) @@ -118,7 +118,7 @@ public class GraphManip { static HashSet getDiffNodes(Delta delta, HashSet srcNodes, FieldDescriptor fd) { HashSet nodes=new HashSet(); for(AllocNode node:srcNodes) { - HashSet removeedges=delta.heapedgeremove.get(node); + MySet removeedges=delta.heapedgeremove.get(node); for(Edge e:delta.baseheapedge.get(node)) { if (e.fd==fd&&(removeedges==null||!removeedges.contains(e))) nodes.add(e.dst); @@ -132,10 +132,42 @@ public class GraphManip { return nodes; } + static MySet getDiffEdges(Delta delta, HashSet srcNodes) { + MySet newedges=new MySet(); + for(Map.Entry> entry:delta.baseheapedge.entrySet()) { + AllocNode node=entry.getKey(); + if (srcNodes.contains(node)) { + MySet edges=entry.getValue(); + MySet removeedges=delta.heapedgeremove.get(node); + for(Edge e:edges) { + if (!removeedges.contains(e)) { + newedges.add(e); + } + } + } + } + for(Map.Entry> entry:delta.heapedgeadd.entrySet()) { + AllocNode node=entry.getKey(); + if (srcNodes.contains(node)) { + MySet edges=entry.getValue(); + newedges.addAll(edges); + } + } + return newedges; + } + + static MySet makeOld(MySet edgesin) { + MySet edgeset=new MySet(); + for(Edge e:edgesin) { + edgeset.add(e.makeOld()); + } + return edgeset; + } + static HashSet getNodes(Graph graph, Delta delta, HashSet srcNodes, FieldDescriptor fd) { HashSet nodes=new HashSet(); for(AllocNode node:srcNodes) { - HashSet removeedges=delta.heapedgeremove.get(node); + MySet removeedges=delta.heapedgeremove.get(node); for(Edge e:graph.getEdges(node)) { if (e.fd==fd&&(removeedges==null||!removeedges.contains(e))) nodes.add(e.dst); diff --git a/Robust/src/Analysis/Pointer/Pointer.java b/Robust/src/Analysis/Pointer/Pointer.java index 9b4e5779..06ead04f 100644 --- a/Robust/src/Analysis/Pointer/Pointer.java +++ b/Robust/src/Analysis/Pointer/Pointer.java @@ -9,6 +9,8 @@ public class Pointer { HashMap blockMap; HashMap bbgraphMap; HashMap graphMap; + HashMap> callMap; + State state; TypeUtil typeUtil; AllocFactory allocFactory; @@ -20,6 +22,7 @@ public class Pointer { this.blockMap=new HashMap(); this.bbgraphMap=new HashMap(); this.graphMap=new HashMap(); + this.callMap=new HashMap>(); this.typeUtil=typeUtil; this.allocFactory=new AllocFactory(state, typeUtil); this.toprocess=new LinkedList(); @@ -39,10 +42,12 @@ public class Pointer { BasicBlock bb=getBBlock(fm); BBlock start=bb.getStart(); Delta delta=new Delta(start, true); - HashSet arrayset=new HashSet(); - HashSet varset=new HashSet(); - arrayset.add(new Edge(allocFactory.StringArray, null, allocFactory.Strings)); - varset.add(new Edge(fm.getParameter(0), allocFactory.StringArray)); + MySet arrayset=new MySet(); + MySet varset=new MySet(); + Edge arrayedge=new Edge(allocFactory.StringArray, null, allocFactory.Strings); + arrayset.add(arrayedge); + Edge stringedge=new Edge(fm.getParameter(0), allocFactory.StringArray); + varset.add(stringedge); delta.heapedgeadd.put(allocFactory.StringArray, arrayset); delta.varedgeadd.put(fm.getParameter(0), varset); return delta; @@ -71,7 +76,7 @@ public class Pointer { delta=processNode(currNode, delta, nodeGraph); } generateFinalDelta(bblock, delta, nodeGraph); - } + } } void generateFinalDelta(BBlock bblock, Delta delta, Graph graph) { @@ -84,7 +89,7 @@ public class Pointer { //Next build the temp map part of the delta for(TempDescriptor tmp:tmpSet) { - HashSet edgeSet=new HashSet(); + MySet edgeSet=new MySet(); /* Get target set */ if (graph.varMap.containsKey(tmp)) edgeSet.addAll(graph.varMap.get(tmp)); @@ -99,7 +104,7 @@ public class Pointer { nodeSet.addAll(graph.parent.nodeMap.keySet()); for(AllocNode node:nodeSet) { - HashSet edgeSet=new HashSet(); + MySet edgeSet=new MySet(); /* Get edge set */ if (graph.nodeMap.containsKey(node)) edgeSet.addAll(graph.nodeMap.get(node)); @@ -115,7 +120,7 @@ public class Pointer { tmpSet.addAll(delta.varedgeadd.keySet()); for(TempDescriptor tmp:tmpSet) { /* Start with the new incoming edges */ - HashSet newbaseedge=delta.basevaredge.get(tmp); + MySet newbaseedge=delta.basevaredge.get(tmp); /* Remove the remove set */ newbaseedge.removeAll(delta.varedgeremove.get(tmp)); /* Add in the new set*/ @@ -131,7 +136,7 @@ public class Pointer { nodeSet.addAll(delta.heapedgeremove.keySet()); for(AllocNode node:nodeSet) { /* Start with the new incoming edges */ - HashSet newheapedge=(HashSet) delta.baseheapedge.get(node).clone(); + MySet newheapedge=(MySet) delta.baseheapedge.get(node).clone(); /* Remove the remove set */ newheapedge.removeAll(delta.heapedgeremove.get(node)); /* Add in the add set */ @@ -139,7 +144,7 @@ public class Pointer { newDelta.heapedgeadd.put(node, newheapedge); /* Also need to subtract off some edges */ - HashSet removeset=delta.heapedgeremove.get(node); + MySet removeset=delta.heapedgeremove.get(node); /* Remove the newly created edges..no need to propagate a diff for those */ removeset.removeAll(delta.baseheapedge.get(node)); newDelta.heapedgeremove.put(node, removeset); @@ -187,20 +192,20 @@ public class Pointer { } } - Delta processFlatCall(FlatCall fcall, Delta delta, Graph newgraph) { + Delta processFlatCall(FlatCall fcall, Delta delta, Graph graph) { Delta newDelta=new Delta(null, false); if (delta.getInit()) { - HashSet edgeset=new HashSet(); + MySet edgeset=new MySet(); HashSet nodeset=new HashSet(); HashSet targetSet=new HashSet(); Stack tovisit=new Stack(); - TempDescriptor tmpthis=fc.getThis(); + TempDescriptor tmpthis=fcall.getThis(); //Handle the this temp if (tmpthis!=null) { - HashSet edges=GraphManip.getEdges(graph, delta, tmpthis); - newdelta.varedgeadd.put(tmpthis, (HashSet) edges.clone()); + MySet edges=GraphManip.getEdges(graph, delta, tmpthis); + newDelta.varedgeadd.put(tmpthis, (MySet) edges.clone()); edgeset.addAll(edges); for(Edge e:edges) { AllocNode dstnode=e.dst; @@ -219,10 +224,10 @@ public class Pointer { } //Go through each temp - for(int i=0;i edges=GraphManip.getEdges(graph, delta, tmp); - newdelta.varedgeadd.put(tmp, (HashSet) edges.clone()); + for(int i=0;i edges=GraphManip.getEdges(graph, delta, tmp); + newDelta.varedgeadd.put(tmp, (MySet) edges.clone()); edgeset.addAll(edges); for(Edge e:edges) { if (!nodeset.contains(e.dst)) { @@ -235,8 +240,8 @@ public class Pointer { //Traverse all reachable nodes while(!tovisit.isEmpty()) { AllocNode node=tovisit.pop(); - HashSet edges=GraphManip.getEdges(graph, delta, node); - newdelta.heapedgeadd.put(node, (HashSet) edges.clone()); + MySet edges=GraphManip.getEdges(graph, delta, node); + newDelta.heapedgeadd.put(node, GraphManip.makeOld(edges)); edgeset.addAll(edges); for(Edge e:edges) { if (!nodeset.contains(e.dst)) { @@ -245,75 +250,272 @@ public class Pointer { } } } + + //Compute call targets + MethodDescriptor md=fcall.getMethod(); + HashSet targets=new HashSet(); + if (md.isStatic()) { + targets.add(md); + } else { + //Compute Edges + for(Edge e:newDelta.varedgeadd.get(tmpthis)) { + AllocNode node=e.dst; + ClassDescriptor cd=node.getType().getClassDesc(); + //Figure out exact method called and add to set + targets.add(cd.getCalledMethod(md)); + } + } + + //Fix mapping + for(MethodDescriptor calledmd:targets) { + FlatMethod fm=state.getMethodFlat(calledmd); + + //Build tmpMap + HashMap tmpMap=new HashMap(); + int offset=0; + if(tmpthis!=null) { + tmpMap.put(tmpthis, fm.getParameter(offset++)); + } + for(int i=0;i()); + } + callMap.get(delta.getBlock()).add(block.getStart()); + + //Hook up returns + for(BBlock retblock:delta.getBlock().next()) { + //Hook up exits + if (!callMap.containsKey(block.getExit())) { + callMap.put(block.getExit(), new HashSet()); + } + callMap.get(block.getExit()).add(retblock); + //NOTE: Need to push deltas here probably + } + } + graph.reachNode=nodeset; + graph.reachEdge=edgeset; //Apply diffs to graph applyDiffs(graph, delta); } else { + MySet edgeset=new MySet(); + HashSet nodeset=new HashSet(); + MySet oldedgeset=graph.reachEdge; + HashSet oldnodeset=graph.reachNode; + + HashSet targetSet=new HashSet(); + Stack tovisit=new Stack(); + TempDescriptor tmpthis=fcall.getThis(); + + //Handle the this temp + if (tmpthis!=null) { + MySet edges=GraphManip.getDiffEdges(delta, tmpthis); + newDelta.varedgeadd.put(tmpthis, (MySet) edges.clone()); + edgeset.addAll(edges); + for(Edge e:edges) { + AllocNode dstnode=e.dst; + if (!nodeset.contains(dstnode)&&!oldnodeset.contains(dstnode)) { + TypeDescriptor type=dstnode.getType(); + if (!type.isArray()) { + targetSet.add(type.getClassDesc()); + } else { + //arrays don't have code + targetSet.add(typeUtil.getClass(TypeUtil.ObjectClass)); + } + nodeset.add(dstnode); + tovisit.add(dstnode); + } + } + } + + //Go through each temp + for(int i=0;i edges=GraphManip.getDiffEdges(delta, tmp); + newDelta.varedgeadd.put(tmp, (MySet) edges.clone()); + edgeset.addAll(edges); + for(Edge e:edges) { + if (!nodeset.contains(e.dst)&&!oldnodeset.contains(e.dst)) { + nodeset.add(e.dst); + tovisit.add(e.dst); + } + } + } + + //Go through each new heap edge that starts from old node + MySet newedges=GraphManip.getDiffEdges(delta, oldnodeset); + edgeset.addAll(newedges); + for(Edge e:newedges) { + if (!nodeset.contains(e.dst)&&!oldnodeset.contains(e.dst)) { + nodeset.add(e.dst); + tovisit.add(e.dst); + } + } + + //Traverse all reachable nodes + while(!tovisit.isEmpty()) { + AllocNode node=tovisit.pop(); + MySet edges=GraphManip.getEdges(graph, delta, node); + + newDelta.heapedgeadd.put(node, GraphManip.makeOld(edges)); + edgeset.addAll(edges); + for(Edge e:edges) { + if (!nodeset.contains(e.dst)&&!oldnodeset.contains(e.dst)) { + nodeset.add(e.dst); + tovisit.add(e.dst); + } + } + } + + //Compute call targets + MethodDescriptor md=fcall.getMethod(); + HashSet targets=new HashSet(); + if (md.isStatic()) { + targets.add(md); + } else { + //Compute Edges + for(Edge e:newDelta.varedgeadd.get(tmpthis)) { + AllocNode node=e.dst; + ClassDescriptor cd=node.getType().getClassDesc(); + //Figure out exact method called and add to set + targets.add(cd.getCalledMethod(md)); + } + } + + //add in new nodeset and edgeset + oldnodeset.addAll(nodeset); + oldedgeset.addAll(edgeset); + Delta basedelta=null; + + //Fix mapping + for(MethodDescriptor calledmd:targets) { + FlatMethod fm=state.getMethodFlat(calledmd); + boolean newmethod=false; + + //Get basicblock for the method + BasicBlock block=getBBlock(fm); + + //Hook up exits + if (!callMap.containsKey(delta.getBlock())) { + callMap.put(delta.getBlock(), new HashSet()); + } + + if (!callMap.get(delta.getBlock()).contains(block.getStart())) { + callMap.get(delta.getBlock()).add(block.getStart()); + newmethod=true; + //Hook up returns + for(BBlock retblock:delta.getBlock().next()) { + //Hook up exits + if (!callMap.containsKey(block.getExit())) { + callMap.put(block.getExit(), new HashSet()); + } + callMap.get(block.getExit()).add(retblock); + //NOTE: Need to push deltas here probably + } + } + + //Build tmpMap + HashMap tmpMap=new HashMap(); + int offset=0; + if(tmpthis!=null) { + tmpMap.put(tmpthis, fm.getParameter(offset++)); + } + for(int i=0;i