1 package Analysis.Pointer;
5 import Analysis.Pointer.BasicBlock.BBlock;
6 import Analysis.Pointer.AllocFactory.AllocNode;
9 HashMap<FlatMethod, BasicBlock> blockMap;
10 HashMap<BBlock, Graph> bbgraphMap;
11 HashMap<FlatNode, Graph> graphMap;
12 HashMap<FlatCall, Set<BBlock>> callMap;
13 HashMap<BBlock, Set<PPoint>> returnMap;
17 AllocFactory allocFactory;
18 LinkedList<Delta> toprocess;
19 TempDescriptor returntmp;
21 public Pointer(State state, TypeUtil typeUtil) {
23 this.blockMap=new HashMap<FlatMethod, BasicBlock>();
24 this.bbgraphMap=new HashMap<BBlock, Graph>();
25 this.graphMap=new HashMap<FlatNode, Graph>();
26 this.callMap=new HashMap<FlatCall, Set<BBlock>>();
27 this.returnMap=new HashMap<BBlock, Set<PPoint>>();
28 this.typeUtil=typeUtil;
29 this.allocFactory=new AllocFactory(state, typeUtil);
30 this.toprocess=new LinkedList<Delta>();
31 ClassDescriptor stringcd=typeUtil.getClass(TypeUtil.ObjectClass);
32 this.returntmp=new TempDescriptor("RETURNVAL", stringcd);
35 public BasicBlock getBBlock(FlatMethod fm) {
36 if (!blockMap.containsKey(fm))
37 blockMap.put(fm, BasicBlock.getBBlock(fm));
38 return blockMap.get(fm);
41 Delta buildInitialContext() {
42 MethodDescriptor md=typeUtil.getMain();
43 FlatMethod fm=state.getMethodFlat(md);
44 BasicBlock bb=getBBlock(fm);
45 BBlock start=bb.getStart();
46 Delta delta=new Delta(new PPoint(start), true);
47 MySet<Edge> arrayset=new MySet<Edge>();
48 MySet<Edge> varset=new MySet<Edge>();
49 Edge arrayedge=new Edge(allocFactory.StringArray, null, allocFactory.Strings);
50 arrayset.add(arrayedge);
51 Edge stringedge=new Edge(fm.getParameter(0), allocFactory.StringArray);
52 varset.add(stringedge);
53 delta.heapedgeadd.put(allocFactory.StringArray, arrayset);
54 delta.varedgeadd.put(fm.getParameter(0), varset);
58 public void doAnalysis() {
59 toprocess.add(buildInitialContext());
61 while(!toprocess.isEmpty()) {
62 Delta delta=toprocess.remove();
63 PPoint ppoint=delta.getBlock();
64 BBlock bblock=ppoint.getBBlock();
65 Vector<FlatNode> nodes=bblock.nodes();
67 if (ppoint.getIndex()==-1) {
68 //Build base graph for entrance to this basic block
69 delta=applyInitDelta(delta, bblock);
71 startindex=ppoint.getIndex()+1;
72 delta=applyCallDelta(delta, bblock);
75 Graph graph=bbgraphMap.get(bblock);
77 //Compute delta at exit of each node
78 for(int i=startindex; i<nodes.size();i++) {
79 FlatNode currNode=nodes.get(i);
80 if (!graphMap.containsKey(currNode)) {
81 graphMap.put(currNode, new Graph(graph));
83 nodeGraph=graphMap.get(currNode);
84 delta=processNode(bblock, i, currNode, delta, nodeGraph);
86 generateFinalDelta(bblock, delta, nodeGraph);
90 void buildInitDelta(Graph graph, Delta newDelta) {
91 //First compute the set of temps
92 HashSet<TempDescriptor> tmpSet=new HashSet<TempDescriptor>();
93 tmpSet.addAll(graph.varMap.keySet());
94 tmpSet.addAll(graph.parent.varMap.keySet());
96 //Next build the temp map part of the delta
97 for(TempDescriptor tmp:tmpSet) {
98 MySet<Edge> edgeSet=new MySet<Edge>();
100 if (graph.varMap.containsKey(tmp))
101 edgeSet.addAll(graph.varMap.get(tmp));
103 edgeSet.addAll(graph.parent.varMap.get(tmp));
104 newDelta.varedgeadd.put(tmp, edgeSet);
107 //Next compute the set of src allocnodes
108 HashSet<AllocNode> nodeSet=new HashSet<AllocNode>();
109 nodeSet.addAll(graph.nodeMap.keySet());
110 nodeSet.addAll(graph.parent.nodeMap.keySet());
112 for(AllocNode node:nodeSet) {
113 MySet<Edge> edgeSet=new MySet<Edge>();
115 if (graph.nodeMap.containsKey(node))
116 edgeSet.addAll(graph.nodeMap.get(node));
118 edgeSet.addAll(graph.parent.nodeMap.get(node));
119 newDelta.heapedgeadd.put(node, edgeSet);
122 if (graph.nodeAges.contains(node))
123 newDelta.addNodeAges.add(node);
124 else if (graph.parent.nodeAges.contains(node))
125 newDelta.addNodeAges.add(node);
128 if (graph.oldNodes.containsKey(node)) {
129 if (graph.oldNodes.get(node).booleanValue())
130 newDelta.addOldNodes.put(node, Boolean.TRUE);
131 } else if (graph.parent.oldNodes.containsKey(node)) {
132 //parent graphs only contain true...no need to check
133 newDelta.addOldNodes.put(node, Boolean.TRUE);
138 void generateFinalDelta(BBlock bblock, Delta delta, Graph graph) {
139 Delta newDelta=new Delta(null, false);
140 if (delta.getInit()) {
141 buildInitDelta(graph, newDelta);
143 /* We can break the old delta...it is done being used */
144 /* First we will build variable edges */
145 HashSet<TempDescriptor> tmpSet=new HashSet<TempDescriptor>();
146 tmpSet.addAll(delta.basevaredge.keySet());
147 tmpSet.addAll(delta.varedgeadd.keySet());
148 for(TempDescriptor tmp:tmpSet) {
149 /* Start with the new incoming edges */
150 MySet<Edge> newbaseedge=delta.basevaredge.get(tmp);
151 /* Remove the remove set */
152 newbaseedge.removeAll(delta.varedgeremove.get(tmp));
153 /* Add in the new set*/
154 newbaseedge.addAll(delta.varedgeadd.get(tmp));
155 /* Store the results */
156 newDelta.varedgeadd.put(tmp, newbaseedge);
159 /* Next we build heap edges */
160 HashSet<AllocNode> nodeSet=new HashSet<AllocNode>();
161 nodeSet.addAll(delta.baseheapedge.keySet());
162 nodeSet.addAll(delta.heapedgeadd.keySet());
163 nodeSet.addAll(delta.heapedgeremove.keySet());
164 for(AllocNode node:nodeSet) {
165 /* Start with the new incoming edges */
166 MySet<Edge> newheapedge=(MySet<Edge>) delta.baseheapedge.get(node).clone();
167 /* Remove the remove set */
168 newheapedge.removeAll(delta.heapedgeremove.get(node));
169 /* Add in the add set */
170 newheapedge.addAll(delta.heapedgeadd.get(node));
171 newDelta.heapedgeadd.put(node, newheapedge);
173 /* Also need to subtract off some edges */
174 MySet<Edge> removeset=delta.heapedgeremove.get(node);
176 /* Remove the newly created edges..no need to propagate a diff for those */
177 removeset.removeAll(delta.baseheapedge.get(node));
178 newDelta.heapedgeremove.put(node, removeset);
181 /* Compute new ages */
182 newDelta.addNodeAges.addAll(delta.baseNodeAges);
183 newDelta.addNodeAges.addAll(delta.addNodeAges);
184 HashSet<AllocNode> oldNodes=new HashSet<AllocNode>();
186 /* Compute whether old nodes survive */
187 oldNodes.addAll(delta.baseOldNodes.keySet());
188 oldNodes.addAll(delta.addOldNodes.keySet());
189 for(AllocNode node:oldNodes) {
190 if (delta.addOldNodes.containsKey(node)) {
191 if (delta.addOldNodes.get(node).booleanValue()) {
192 newDelta.addOldNodes.put(node, Boolean.TRUE);
195 if (delta.baseOldNodes.get(node).booleanValue()) {
196 newDelta.addOldNodes.put(node, Boolean.TRUE);
202 /* Now we need to propagate newdelta */
203 if (!newDelta.heapedgeadd.isEmpty()||!newDelta.heapedgeremove.isEmpty()||!newDelta.varedgeadd.isEmpty()||!newDelta.addNodeAges.isEmpty()||!newDelta.addOldNodes.isEmpty()) {
204 /* We have a delta to propagate */
205 Vector<BBlock> blockvector=bblock.next();
206 for(int i=0;i<blockvector.size();i++) {
208 newDelta.setBlock(new PPoint(blockvector.get(i)));
209 toprocess.add(newDelta);
211 toprocess.add(newDelta.diffBlock(new PPoint(blockvector.get(i))));
217 Delta processNode(BBlock bblock, int index, FlatNode node, Delta delta, Graph newgraph) {
218 switch(node.kind()) {
220 return processNewNode((FlatNew)node, delta, newgraph);
221 case FKind.FlatFieldNode:
222 case FKind.FlatElementNode:
223 return processFieldElementNode(node, delta, newgraph);
224 case FKind.FlatCastNode:
225 case FKind.FlatOpNode:
226 case FKind.FlatReturnNode:
227 return processCopyNode(node, delta, newgraph);
228 case FKind.FlatSetFieldNode:
229 case FKind.FlatSetElementNode:
230 return processSetFieldElementNode(node, delta, newgraph);
231 case FKind.FlatMethod:
233 return processFlatNop(node, delta, newgraph);
235 return processFlatCall(bblock, index, (FlatCall) node, delta, newgraph);
236 case FKind.FlatSESEEnterNode:
237 case FKind.FlatSESEExitNode:
238 throw new Error("Unimplemented node:"+node);
240 throw new Error("Unrecognized node:"+node);
245 void processThisTargets(HashSet<ClassDescriptor> targetSet, Graph graph, Delta delta, Delta newDelta, HashSet<AllocNode> nodeset, Stack<AllocNode> tovisit, MySet<Edge> edgeset, TempDescriptor tmpthis, HashSet<AllocNode> oldnodeset) {
246 //Handle the this temp
248 MySet<Edge> edges=(oldnodeset!=null)?GraphManip.getDiffEdges(delta, tmpthis):GraphManip.getEdges(graph, delta, tmpthis);
249 newDelta.varedgeadd.put(tmpthis, (MySet<Edge>) edges.clone());
250 edgeset.addAll(edges);
252 AllocNode dstnode=e.dst;
253 if (!nodeset.contains(dstnode)&&(oldnodeset==null||!oldnodeset.contains(dstnode))) {
254 TypeDescriptor type=dstnode.getType();
255 if (!type.isArray()) {
256 targetSet.add(type.getClassDesc());
258 //arrays don't have code
259 targetSet.add(typeUtil.getClass(TypeUtil.ObjectClass));
261 nodeset.add(dstnode);
262 tovisit.add(dstnode);
268 void processParams(Graph graph, Delta delta, Delta newDelta, HashSet<AllocNode> nodeset, Stack<AllocNode> tovisit, MySet<Edge> edgeset, FlatCall fcall, boolean diff) {
269 //Go through each temp
270 for(int i=0;i<fcall.numArgs();i++) {
271 TempDescriptor tmp=fcall.getArg(i);
272 MySet<Edge> edges=diff?GraphManip.getDiffEdges(delta, tmp):GraphManip.getEdges(graph, delta, tmp);
273 newDelta.varedgeadd.put(tmp, (MySet<Edge>) edges.clone());
274 edgeset.addAll(edges);
276 if (!nodeset.contains(e.dst)) {
284 void computeReachableNodes(Graph graph, Delta delta, Delta newDelta, HashSet<AllocNode> nodeset, Stack<AllocNode> tovisit, MySet<Edge> edgeset, HashSet<AllocNode> oldnodeset) {
285 while(!tovisit.isEmpty()) {
286 AllocNode node=tovisit.pop();
287 MySet<Edge> edges=GraphManip.getEdges(graph, delta, node);
288 newDelta.heapedgeadd.put(node, edges);
289 edgeset.addAll(edges);
291 if (!nodeset.contains(e.dst)&&(oldnodeset==null||!oldnodeset.contains(e.dst))) {
299 HashSet<MethodDescriptor> computeTargets(FlatCall fcall, Delta newDelta) {
300 TempDescriptor tmpthis=fcall.getThis();
301 MethodDescriptor md=fcall.getMethod();
302 HashSet<MethodDescriptor> targets=new HashSet<MethodDescriptor>();
307 for(Edge e:newDelta.varedgeadd.get(tmpthis)) {
308 AllocNode node=e.dst;
309 ClassDescriptor cd=node.getType().getClassDesc();
310 //Figure out exact method called and add to set
311 targets.add(cd.getCalledMethod(md));
320 void fixMapping(FlatCall fcall, HashSet<MethodDescriptor> targets, MySet<Edge> oldedgeset, Delta newDelta, BBlock callblock, int callindex) {
321 Delta basedelta=null;
322 TempDescriptor tmpthis=fcall.getThis();
324 for(MethodDescriptor calledmd:targets) {
325 FlatMethod fm=state.getMethodFlat(calledmd);
326 boolean newmethod=false;
329 HashMap<TempDescriptor, TempDescriptor> tmpMap=new HashMap<TempDescriptor, TempDescriptor>();
332 tmpMap.put(tmpthis, fm.getParameter(offset++));
334 for(int i=0;i<fcall.numArgs();i++) {
335 TempDescriptor tmp=fcall.getArg(i);
336 tmpMap.put(tmp,fm.getParameter(i+offset));
339 //Get basicblock for the method
340 BasicBlock block=getBBlock(fm);
343 if (!callMap.containsKey(fcall)) {
344 callMap.put(fcall, new HashSet<BBlock>());
347 Delta returnDelta=null;
348 if (!callMap.get(fcall).contains(block.getStart())) {
349 callMap.get(fcall).add(block.getStart());
353 if (!returnMap.containsKey(block.getExit())) {
354 returnMap.put(block.getExit(), new HashSet<PPoint>());
356 returnMap.get(block.getExit()).add(new PPoint(callblock, callindex));
358 if (bbgraphMap.containsKey(block.getExit())) {
359 //Need to push existing results to current node
360 if (returnDelta==null) {
361 returnDelta=new Delta(null, false);
362 buildInitDelta(bbgraphMap.get(block.getExit()), returnDelta);
363 if (!returnDelta.heapedgeadd.isEmpty()||!returnDelta.heapedgeremove.isEmpty()||!returnDelta.varedgeadd.isEmpty()) {
364 returnDelta.setBlock(new PPoint(callblock, callindex));
365 toprocess.add(returnDelta);
368 if (!returnDelta.heapedgeadd.isEmpty()||!returnDelta.heapedgeremove.isEmpty()||!returnDelta.varedgeadd.isEmpty()) {
369 toprocess.add(returnDelta.diffBlock(new PPoint(callblock, callindex)));
375 if (oldedgeset==null) {
376 //First build of this graph
377 //Build and enqueue delta...safe to just use existing delta
378 Delta d=newDelta.changeParams(tmpMap, new PPoint(block.getStart()));
380 } else if (newmethod) {
381 if (basedelta==null) {
382 basedelta=newDelta.buildBase(oldedgeset);
384 //Build and enqueue delta
385 Delta d=basedelta.changeParams(tmpMap, new PPoint(block.getStart()));
388 //Build and enqueue delta
389 Delta d=newDelta.changeParams(tmpMap, new PPoint(block.getStart()));
396 /* This function computes all edges that start outside of the callee context and go into the callee context */
398 void computeExternalEdges(Graph graph, Delta delta, HashSet<AllocNode> nodeset, HashSet<AllocNode> deltaset, MySet<Edge> externaledgeset) {
399 //Do heap edges first
400 HashSet<AllocNode> externalnodes=new HashSet<AllocNode>();
401 externalnodes.addAll(delta.baseheapedge.keySet());
402 externalnodes.addAll(delta.heapedgeadd.keySet());
403 externalnodes.addAll(delta.heapedgeremove.keySet());
404 //remove allinternal nodes
405 externalnodes.removeAll(nodeset);
406 for(AllocNode extNode:externalnodes) {
407 //Compute set of edges from given node
408 MySet<Edge> edges=new MySet<Edge>(delta.baseheapedge.get(extNode));
409 edges.removeAll(delta.heapedgeremove.get(extNode));
410 edges.addAll(delta.heapedgeadd.get(extNode));
413 if (nodeset.contains(e.dst))
414 externaledgeset.add(e);
418 //Do heap edges first
419 HashSet<TempDescriptor> temps=new HashSet<TempDescriptor>();
420 temps.addAll(delta.basevaredge.keySet());
421 temps.addAll(delta.varedgeadd.keySet());
422 temps.addAll(delta.varedgeremove.keySet());
423 //remove allinternal nodes
424 temps.removeAll(nodeset);
426 for(TempDescriptor tmp:temps) {
427 //Compute set of edges from given node
428 MySet<Edge> edges=new MySet<Edge>(delta.basevaredge.get(tmp));
429 edges.removeAll(delta.varedgeremove.get(tmp));
430 edges.addAll(delta.varedgeadd.get(tmp));
433 if (nodeset.contains(e.dst))
434 externaledgeset.add(e);
439 void removeEdges(Delta delta, HashSet<AllocNode> nodeset, MySet<Edge> edgeset, MySet<Edge> externaledgeset) {
440 //Want to remove the set of internal edges
441 for(Edge e:edgeset) {
443 if (delta.heapedgeadd.containsKey(e.src)&&delta.heapedgeadd.get(e.src).contains(e)) {
444 //remove edge if it is in the add set
445 delta.heapedgeadd.get(e.src).remove(e);
447 //add edge to to the remove set
448 if (!delta.heapedgeremove.containsKey(e.src))
449 delta.heapedgeremove.put(e.src, new MySet<Edge>());
450 delta.heapedgeremove.get(e.src).add(e);
455 //Want to remove the set of external edges
456 for(Edge e:externaledgeset) {
457 //want to remove the set of internal edges
459 if (delta.heapedgeadd.containsKey(e.src)&&delta.heapedgeadd.get(e.src).contains(e)) {
460 //remove edge if it is in the add set
461 delta.heapedgeadd.get(e.src).remove(e);
463 //add edge to to the remove set
464 if (!delta.heapedgeremove.containsKey(e.src))
465 delta.heapedgeremove.put(e.src, new MySet<Edge>());
466 delta.heapedgeremove.get(e.src).add(e);
469 if (delta.varedgeadd.containsKey(e.srcvar)&&delta.varedgeadd.get(e.srcvar).contains(e)) {
470 //remove edge if it is in the add set
471 delta.varedgeadd.get(e.srcvar).remove(e);
473 //add edge to to the remove set
474 if (!delta.varedgeremove.containsKey(e.srcvar))
475 delta.varedgeremove.put(e.srcvar,new MySet<Edge>());
476 delta.varedgeremove.get(e.srcvar).add(e);
483 Delta processFlatCall(BBlock callblock, int callindex, FlatCall fcall, Delta delta, Graph graph) {
484 Delta newDelta=new Delta(null, false);
486 if (delta.getInit()) {
487 MySet<Edge> edgeset=new MySet<Edge>();
488 MySet<Edge> externaledgeset=new MySet<Edge>();
489 HashSet<AllocNode> nodeset=new HashSet<AllocNode>();
490 HashSet<ClassDescriptor> targetSet=new HashSet<ClassDescriptor>();
491 Stack<AllocNode> tovisit=new Stack<AllocNode>();
492 TempDescriptor tmpthis=fcall.getThis();
494 //Handle the this temp
495 processThisTargets(targetSet, graph, delta, newDelta, nodeset, tovisit, edgeset, tmpthis, null);
497 //Go through each temp
498 processParams(graph, delta, newDelta, nodeset, tovisit, edgeset, fcall, false);
500 //Traverse all reachable nodes
501 computeReachableNodes(graph, delta, newDelta, nodeset, tovisit, edgeset, null);
503 //Compute call targets
504 HashSet<MethodDescriptor> targets=computeTargets(fcall, newDelta);
507 fixMapping(fcall, targets, null, newDelta, callblock, callindex);
509 //Compute edges into region to splice out
510 computeExternalEdges(graph, delta, nodeset, null, externaledgeset);
512 //Splice out internal edges
513 removeEdges(delta, nodeset, edgeset, externaledgeset);
515 graph.reachNode=nodeset;
516 graph.reachEdge=edgeset;
518 graph.callNodeAges=new HashSet<AllocNode>();
519 graph.callOldNodes=new HashSet<AllocNode>();
521 //Apply diffs to graph
522 applyDiffs(graph, delta, true);
524 MySet<Edge> edgeset=new MySet<Edge>();
525 MySet<Edge> externaledgeset=new MySet<Edge>();
526 HashSet<AllocNode> nodeset=new HashSet<AllocNode>();
527 MySet<Edge> oldedgeset=graph.reachEdge;
528 HashSet<AllocNode> oldnodeset=graph.reachNode;
530 HashSet<ClassDescriptor> targetSet=new HashSet<ClassDescriptor>();
531 Stack<AllocNode> tovisit=new Stack<AllocNode>();
532 TempDescriptor tmpthis=fcall.getThis();
534 //Handle the this temp
535 processThisTargets(targetSet, graph, delta, newDelta, nodeset, tovisit, edgeset, tmpthis, oldnodeset);
537 //Go through each temp
538 processParams(graph, delta, newDelta, nodeset, tovisit, edgeset, fcall, true);
540 //Go through each new heap edge that starts from old node
541 MySet<Edge> newedges=GraphManip.getDiffEdges(delta, oldnodeset);
542 edgeset.addAll(newedges);
543 for(Edge e:newedges) {
544 if (!nodeset.contains(e.dst)&&!oldnodeset.contains(e.dst)) {
550 //Traverse all reachable nodes
551 computeReachableNodes(graph, delta, newDelta, nodeset, tovisit, edgeset, oldnodeset);
553 //Compute call targets
554 HashSet<MethodDescriptor> targets=computeTargets(fcall, newDelta);
556 //add in new nodeset and edgeset
557 oldnodeset.addAll(nodeset);
558 oldedgeset.addAll(edgeset);
561 fixMapping(fcall, targets, oldedgeset, newDelta, callblock, callindex);
563 //Compute edges into region to splice out
564 computeExternalEdges(graph, delta, oldnodeset, nodeset, externaledgeset);
566 //Splice out internal edges
567 removeEdges(delta, nodeset, edgeset, externaledgeset);
569 //Apply diffs to graph
570 applyDiffs(graph, delta);
577 Delta applyCallDelta(Delta delta, BBlock bblock) {
578 Delta newDelta=new Delta(null, false);
579 Vector<FlatNode> nodes=bblock.nodes();
580 PPoint ppoint=delta.getBlock();
581 FlatCall fcall=(FlatCall)nodes.get(ppoint.getIndex());
582 Graph graph=graphMap.get(fcall);
583 Graph oldgraph=(ppoint.getIndex()==0)?
584 bbgraphMap.get(bblock):
585 graphMap.get(nodes.get(ppoint.getIndex()-1));
587 //Age outside edges if necessary
588 for(Iterator<AllocNode> nodeit=delta.addNodeAges.iterator();nodeit.hasNext();) {
589 AllocNode node=nodeit.next();
590 if (!graph.callNodeAges.contains(node)) {
591 graph.callNodeAges.add(node);
595 if (!graph.reachNode.contains(node)&&!node.isSummary()) {
596 /* Need to age node in existing graph*/
597 summarizeInGraph(graph, newDelta, node);
602 for(Map.Entry<AllocNode, MySet<Edge>> entry:delta.heapedgeadd.entrySet()) {
603 for(Edge e:entry.getValue()) {
604 boolean addedge=false;
606 if (e.statuspredicate==Edge.NEW) {
609 Edge origEdgeKey=e.makeStatus(allocFactory);
610 if (oldgraph.nodeMap.containsKey(origEdgeKey.src)&&
611 oldgraph.nodeMap.get(origEdgeKey.src).contains(origEdgeKey)) {
612 Edge origEdge=oldgraph.nodeMap.get(origEdgeKey.src).get(origEdgeKey);
614 origEdgeKey.statuspredicate=origEdge.statuspredicate;
615 edgetoadd=origEdgeKey;
618 if (edgetoadd!=null) {
619 if (newDelta.heapedgeadd.containsKey(edgetoadd.src))
620 newDelta.heapedgeadd.put(edgetoadd.src, new MySet<Edge>(edgetoadd));
622 newDelta.heapedgeadd.get(edgetoadd.src).add(edgetoadd);
631 /* Summarizes out of context nodes in graph */
632 void summarizeInGraph(Graph graph, Delta newDelta, AllocNode singleNode) {
633 AllocNode summaryNode=allocFactory.getAllocNode(singleNode, true);
635 //Handle outgoing heap edges
636 MySet<Edge> edgeset=graph.getEdges(singleNode);
638 for(Edge e:edgeset) {
639 Edge rewrite=e.rewrite(singleNode, summaryNode);
641 if (!newDelta.heapedgeremove.containsKey(singleNode))
642 newDelta.heapedgeremove.put(singleNode, new MySet<Edge>(e));
644 newDelta.heapedgeremove.get(singleNode).add(e);
647 if (!newDelta.heapedgeremove.containsKey(summaryNode))
648 newDelta.heapedgeremove.put(summaryNode, new MySet<Edge>(rewrite));
650 newDelta.heapedgeremove.get(summaryNode).add(rewrite);
653 //Handle incoming edges
654 MySet<Edge> backedges=graph.getBackEdges(singleNode);
655 for(Edge e:backedges) {
656 if (e.dst==singleNode) {
657 Edge rewrite=e.rewrite(singleNode, summaryNode);
660 if (!newDelta.heapedgeremove.containsKey(e.src))
661 newDelta.heapedgeremove.put(e.src, new MySet<Edge>(e));
663 newDelta.heapedgeremove.get(e.src).add(e);
665 if (!newDelta.heapedgeadd.containsKey(summaryNode))
666 newDelta.heapedgeadd.put(summaryNode, new MySet<Edge>(rewrite));
668 newDelta.heapedgeadd.get(summaryNode).add(rewrite);
672 if (!newDelta.varedgeremove.containsKey(e.srcvar))
673 newDelta.varedgeremove.put(e.srcvar, new MySet<Edge>(e));
675 newDelta.varedgeremove.get(e.srcvar).add(e);
677 if (!newDelta.varedgeadd.containsKey(e.srcvar))
678 newDelta.varedgeadd.put(e.srcvar, new MySet<Edge>(rewrite));
680 newDelta.varedgeadd.get(e.srcvar).add(rewrite);
686 void applyDiffs(Graph graph, Delta delta) {
687 applyDiffs(graph, delta, false);
690 void applyDiffs(Graph graph, Delta delta, boolean genbackwards) {
691 //build backwards map if requested
692 if (genbackwards&&graph.backMap==null) {
693 graph.backMap=new HashMap<AllocNode, MySet<Edge>>();
694 if (graph.parent.backMap==null) {
695 graph.parent.backMap=new HashMap<AllocNode, MySet<Edge>>();
696 for(Map.Entry<AllocNode, MySet<Edge>> entry:graph.nodeMap.entrySet()) {
697 for(Edge e:entry.getValue()) {
698 if (!graph.parent.backMap.containsKey(e.dst))
699 graph.parent.backMap.put(e.dst, new MySet<Edge>());
700 graph.parent.backMap.get(e.dst).add(e);
703 for(Map.Entry<TempDescriptor, MySet<Edge>> entry:graph.varMap.entrySet()) {
704 for(Edge e:entry.getValue()) {
705 if (!graph.parent.backMap.containsKey(e.dst))
706 graph.parent.backMap.put(e.dst, new MySet<Edge>());
707 graph.parent.backMap.get(e.dst).add(e);
713 //Add hidden base edges
714 for(Map.Entry<AllocNode, MySet<Edge>> e: delta.baseheapedge.entrySet()) {
715 AllocNode node=e.getKey();
716 MySet<Edge> edges=e.getValue();
717 if (graph.nodeMap.containsKey(node)) {
718 MySet<Edge> nodeEdges=graph.nodeMap.get(node);
719 nodeEdges.addAll(edges);
724 for(Map.Entry<AllocNode, MySet<Edge>> e: delta.heapedgeremove.entrySet()) {
725 AllocNode node=e.getKey();
726 MySet<Edge> edgestoremove=e.getValue();
727 if (graph.nodeMap.containsKey(node)) {
728 //Just apply diff to current map
729 graph.nodeMap.get(node).removeAll(edgestoremove);
731 //Generate diff from parent graph
732 MySet<Edge> parentedges=graph.parent.nodeMap.get(node);
733 MySet<Edge> newedgeset=Util.setSubtract(parentedges, edgestoremove);
734 graph.nodeMap.put(node, newedgeset);
739 for(Map.Entry<AllocNode, MySet<Edge>> e: delta.heapedgeadd.entrySet()) {
740 AllocNode node=e.getKey();
741 MySet<Edge> edgestoadd=e.getValue();
742 //If we have not done a subtract, then
743 if (!graph.nodeMap.containsKey(node)) {
744 //Copy the parent entry
745 graph.nodeMap.put(node, (MySet<Edge>)graph.parent.nodeMap.get(node).clone());
747 graph.nodeMap.get(node).addAll(edgestoadd);
749 for(Edge eadd:edgestoadd) {
750 if (!graph.backMap.containsKey(eadd.dst))
751 graph.backMap.put(eadd.dst, new MySet<Edge>());
752 graph.backMap.get(eadd.dst).add(eadd);
758 for(Map.Entry<TempDescriptor, MySet<Edge>> e: delta.varedgeremove.entrySet()) {
759 TempDescriptor tmp=e.getKey();
760 MySet<Edge> edgestoremove=e.getValue();
762 if (graph.varMap.containsKey(tmp)) {
763 //Just apply diff to current map
764 graph.varMap.get(tmp).removeAll(edgestoremove);
766 //Generate diff from parent graph
767 MySet<Edge> parentedges=graph.parent.varMap.get(tmp);
768 MySet<Edge> newedgeset=Util.setSubtract(parentedges, edgestoremove);
769 graph.varMap.put(tmp, newedgeset);
774 for(Map.Entry<TempDescriptor, MySet<Edge>> e: delta.varedgeadd.entrySet()) {
775 TempDescriptor tmp=e.getKey();
776 MySet<Edge> edgestoadd=e.getValue();
777 graph.varMap.put(tmp, (MySet<Edge>) edgestoadd.clone());
779 for(Edge eadd:edgestoadd) {
780 if (!graph.backMap.containsKey(eadd.dst))
781 graph.backMap.put(eadd.dst, new MySet<Edge>());
782 graph.backMap.get(eadd.dst).add(eadd);
788 for(AllocNode node:delta.addNodeAges) {
789 graph.nodeAges.add(node);
792 for(Map.Entry<AllocNode, Boolean> nodeentry:delta.addOldNodes.entrySet()) {
793 AllocNode node=nodeentry.getKey();
794 Boolean ispresent=nodeentry.getValue();
795 graph.oldNodes.put(node, ispresent);
799 Delta processSetFieldElementNode(FlatNode node, Delta delta, Graph graph) {
803 if (node.kind()==FKind.FlatSetElementNode) {
804 FlatSetElementNode fen=(FlatSetElementNode) node;
809 FlatSetFieldNode ffn=(FlatSetFieldNode) node;
814 if (delta.getInit()) {
815 HashSet<AllocNode> srcNodes=GraphManip.getNodes(graph, delta, src);
816 HashSet<AllocNode> dstNodes=GraphManip.getNodes(graph, delta, dst);
817 MySet<Edge> edgesToAdd=GraphManip.genEdges(srcNodes, fd, dstNodes);
818 MySet<Edge> edgesToRemove=null;
819 if (dstNodes.size()==1&&!dstNodes.iterator().next().isSummary()) {
820 /* Can do a strong update */
821 edgesToRemove=GraphManip.getEdges(graph, delta, dstNodes, fd);
824 updateHeapDelta(graph, delta, edgesToAdd, edgesToRemove);
825 applyDiffs(graph, delta);
827 /* First look at new sources */
828 MySet<Edge> edgesToAdd=new MySet<Edge>();
829 HashSet<AllocNode> newSrcNodes=GraphManip.getDiffNodes(delta, src);
830 HashSet<AllocNode> dstNodes=GraphManip.getDiffNodes(delta, dst);
831 edgesToAdd.addAll(GraphManip.genEdges(newSrcNodes, fd, dstNodes));
832 HashSet<AllocNode> newDstNodes=GraphManip.getDiffNodes(delta, dst);
833 MySet<Edge> edgesToRemove=null;
834 if (newDstNodes.size()!=0) {
835 if (dstNodes.size()==1&&!dstNodes.iterator().next().isSummary()) {
836 /* Need to undo strong update */
837 if (graph.strongUpdateSet!=null) {
838 edgesToAdd.addAll(graph.strongUpdateSet);
839 graph.strongUpdateSet.clear();
841 } else if (dstNodes.size()==0&&newDstNodes.size()==1&&!newDstNodes.iterator().next().isSummary()&&graph.strongUpdateSet==null) {
842 edgesToRemove=GraphManip.getEdges(graph, delta, dstNodes, fd);
844 HashSet<AllocNode> srcNodes=GraphManip.getDiffNodes(delta, src);
845 edgesToAdd.addAll(GraphManip.genEdges(srcNodes, fd, newDstNodes));
848 updateHeapDelta(graph, delta, edgesToAdd, edgesToRemove);
849 applyDiffs(graph, delta);
854 Delta processCopyNode(FlatNode node, Delta delta, Graph graph) {
857 if (node.kind()==FKind.FlatOpNode) {
858 FlatOpNode fon=(FlatOpNode) node;
861 } else if (node.kind()==FKind.FlatReturnNode) {
862 FlatReturnNode frn=(FlatReturnNode)node;
863 src=frn.getReturnTemp();
866 FlatCastNode fcn=(FlatCastNode) node;
870 if (delta.getInit()) {
871 HashSet<AllocNode> srcnodes=GraphManip.getNodes(graph, delta, src);
872 MySet<Edge> edgesToAdd=GraphManip.genEdges(src, srcnodes);
873 MySet<Edge> edgesToRemove=GraphManip.getEdges(graph, delta, dst);
874 updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);
875 applyDiffs(graph, delta);
877 /* First compute new src nodes */
878 HashSet<AllocNode> newSrcNodes=GraphManip.getDiffNodes(delta, src);
880 /* Compute the union, and then the set of edges */
881 MySet<Edge> edgesToAdd=GraphManip.genEdges(src, newSrcNodes);
883 /* Compute set of edges to remove */
884 MySet<Edge> edgesToRemove=GraphManip.getDiffEdges(delta, dst);
887 updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);
888 applyDiffs(graph, delta);
893 Delta processFieldElementNode(FlatNode node, Delta delta, Graph graph) {
897 if (node.kind()==FKind.FlatElementNode) {
898 FlatElementNode fen=(FlatElementNode) node;
903 FlatFieldNode ffn=(FlatFieldNode) node;
908 if (delta.getInit()) {
909 HashSet<AllocNode> srcnodes=GraphManip.getNodes(graph, delta, src);
910 HashSet<AllocNode> fdnodes=GraphManip.getNodes(graph, delta, srcnodes, fd);
911 MySet<Edge> edgesToAdd=GraphManip.genEdges(src, fdnodes);
912 MySet<Edge> edgesToRemove=GraphManip.getEdges(graph, delta, dst);
913 updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);
914 applyDiffs(graph, delta);
916 /* First compute new objects we read fields of */
917 HashSet<AllocNode> allsrcnodes=GraphManip.getNodes(graph, delta, src);
918 HashSet<AllocNode> difffdnodes=GraphManip.getDiffNodes(delta, allsrcnodes, fd);
919 /* Next compute new targets of fields */
920 HashSet<AllocNode> newsrcnodes=GraphManip.getDiffNodes(delta, src);
921 HashSet<AllocNode> newfdnodes=GraphManip.getNodes(graph, delta, newsrcnodes, fd);
922 /* Compute the union, and then the set of edges */
923 HashSet<AllocNode> newTargets=new HashSet<AllocNode>();
924 newTargets.addAll(newfdnodes);
925 newTargets.addAll(difffdnodes);
926 MySet<Edge> edgesToAdd=GraphManip.genEdges(src, newTargets);
928 /* Compute set of edges to remove */
929 MySet<Edge> edgesToRemove=GraphManip.getDiffEdges(delta, dst);
932 updateVarDelta(graph, delta, dst, edgesToAdd, edgesToRemove);
933 applyDiffs(graph, delta);
938 static void updateVarDelta(Graph graph, Delta delta, TempDescriptor tmp, MySet<Edge> edgestoAdd, MySet<Edge> edgestoRemove) {
939 MySet<Edge> edgeAdd=delta.varedgeadd.get(tmp);
940 MySet<Edge> edgeRemove=delta.varedgeremove.get(tmp);
941 MySet<Edge> existingEdges=graph.getEdges(tmp);
942 for(Edge e: edgestoRemove) {
943 //remove edge from delta
945 //if the edge is already in the graph, add an explicit remove to the delta
946 if (existingEdges.contains(e))
949 for(Edge e: edgestoAdd) {
950 //Remove the edge from the remove set
951 edgeRemove.remove(e);
952 //Explicitly add it to the add set unless it is already in the graph
953 if (!existingEdges.contains(e))
958 static void updateHeapDelta(Graph graph, Delta delta, MySet<Edge> edgestoAdd, MySet<Edge> edgestoRemove) {
959 for(Edge e: edgestoRemove) {
961 MySet<Edge> edgeAdd=delta.heapedgeadd.get(src);
962 MySet<Edge> existingEdges=graph.getEdges(src);
963 //remove edge from delta
965 //if the edge is already in the graph, add an explicit remove to the delta
966 if (existingEdges.contains(e)) {
967 MySet<Edge> edgeRemove=delta.heapedgeremove.get(src);
971 for(Edge e: edgestoAdd) {
973 MySet<Edge> edgeRemove=delta.heapedgeremove.get(src);
974 MySet<Edge> existingEdges=graph.getEdges(src);
975 //Remove the edge from the remove set
976 edgeRemove.remove(e);
977 //Explicitly add it to the add set unless it is already in the graph
978 if (!existingEdges.contains(e)) {
979 MySet<Edge> edgeAdd=delta.heapedgeadd.get(src);
985 Delta processFlatNop(FlatNode node, Delta delta, Graph graph) {
986 applyDiffs(graph, delta);
990 Delta processNewNode(FlatNew node, Delta delta, Graph graph) {
991 AllocNode summary=allocFactory.getAllocNode(node, true);
992 AllocNode single=allocFactory.getAllocNode(node, false);
993 TempDescriptor tmp=node.getDst();
995 if (delta.getInit()) {
996 /* We don't have to deal with summarization here... The
997 * intuition is that this is the only place where we generate
998 * nodes for this allocation site and this is the first time
999 * we've analyzed this site */
1002 Edge e=new Edge(tmp, single);
1003 //Build new Edge set
1004 MySet<Edge> newedges=new MySet<Edge>();
1006 //Add it into the diffs
1007 delta.varedgeadd.put(tmp, newedges);
1008 //Remove the old edges
1009 delta.varedgeremove.put(tmp, graph.getEdges(tmp));
1010 //Apply incoming diffs to graph
1011 applyDiffs(graph, delta);
1012 //Note that we create a single node
1013 delta.addNodeAges.add(single);
1015 if (delta.addOldNodes.containsKey(single)||delta.baseOldNodes.containsKey(single)) {
1016 delta.addOldNodes.put(single, Boolean.FALSE);
1019 /* 1. Fix up the variable edge additions */
1021 for(Iterator<Map.Entry<TempDescriptor, MySet<Edge>>> entryIt=delta.varedgeadd.entrySet().iterator();entryIt.hasNext();) {
1022 Map.Entry<TempDescriptor, MySet<Edge>> entry=entryIt.next();
1024 if (entry.getKey()==tmp) {
1025 /* Check if this is the tmp we overwrite */
1028 /* Otherwise, check if the target of the edge is changed... */
1029 summarizeSet(entry.getValue(), graph.varMap.get(entry.getKey()), single, summary);
1033 /* 2. Fix up the base variable edges */
1035 for(Iterator<Map.Entry<TempDescriptor, MySet<Edge>>> entryIt=delta.basevaredge.entrySet().iterator();entryIt.hasNext();) {
1036 Map.Entry<TempDescriptor, MySet<Edge>> entry=entryIt.next();
1037 TempDescriptor entrytmp=entry.getKey();
1038 if (entrytmp==tmp) {
1039 /* Check is this is the tmp we overwrite, if so add to remove set */
1040 Util.relationUpdate(delta.varedgeremove, tmp, null, entry.getValue());
1042 /* Check if the target of the edge is changed */
1043 MySet<Edge> newset=(MySet<Edge>)entry.getValue().clone();
1044 MySet<Edge> removeset=shrinkSet(newset, graph.varMap.get(entrytmp), single, summary);
1045 Util.relationUpdate(delta.varedgeremove, entrytmp, newset, removeset);
1046 Util.relationUpdate(delta.varedgeadd, entrytmp, null, newset);
1051 /* 3. Fix up heap edge additions */
1053 HashMap<AllocNode, MySet<Edge>> addheapedge=new HashMap<AllocNode, MySet<Edge>>();
1054 for(Iterator<Map.Entry<AllocNode, MySet<Edge>>> entryIt=delta.heapedgeadd.entrySet().iterator();entryIt.hasNext();) {
1055 Map.Entry<AllocNode, MySet<Edge>> entry=entryIt.next();
1056 MySet<Edge> edgeset=entry.getValue();
1057 AllocNode allocnode=entry.getKey();
1058 if (allocnode==single) {
1060 summarizeSet(edgeset, graph.nodeMap.get(summary), single, summary);
1061 addheapedge.put(summary, edgeset);
1063 summarizeSet(edgeset, graph.nodeMap.get(allocnode), single, summary);
1067 /* Merge in diffs */
1069 for(Map.Entry<AllocNode, MySet<Edge>> entry:addheapedge.entrySet()) {
1070 AllocNode allocnode=entry.getKey();
1071 Util.relationUpdate(delta.heapedgeadd, allocnode, null, entry.getValue());
1074 /* 4. Fix up the base heap edges */
1076 for(Iterator<Map.Entry<AllocNode, MySet<Edge>>> entryIt=delta.baseheapedge.entrySet().iterator();entryIt.hasNext();) {
1077 Map.Entry<AllocNode, MySet<Edge>> entry=entryIt.next();
1078 MySet<Edge> edgeset=entry.getValue();
1079 AllocNode allocnode=entry.getKey();
1080 if (allocnode==single) {
1083 AllocNode addnode=(allocnode==single)?summary:allocnode;
1085 MySet<Edge> newset=(MySet<Edge>) edgeset.clone();
1086 MySet<Edge> removeset=shrinkSet(newset, graph.nodeMap.get(addnode), single, summary);
1087 Util.relationUpdate(delta.heapedgeadd, addnode, null, newset);
1088 Util.relationUpdate(delta.heapedgeremove, allocnode, null, removeset);
1091 /* Update Node Ages...If the base or addNodeAges set contains a
1092 * single node, it now should also contain a summary node... No
1093 * need to generate a single node as that has already been
1095 if (delta.baseNodeAges.contains(single)||delta.addNodeAges.contains(single)) {
1096 delta.addNodeAges.add(summary);
1099 //Kill the old node if someone tries to add it
1100 if (delta.addOldNodes.containsKey(single)||delta.baseOldNodes.containsKey(single)) {
1101 delta.addOldNodes.put(single, Boolean.FALSE);
1104 //Apply incoming diffs to graph
1105 applyDiffs(graph, delta);
1110 /* This function builds a new edge set where oldnode is summarized into new node */
1112 void summarizeSet(MySet<Edge> edgeset, MySet<Edge> oldedgeset, AllocNode oldnode, AllocNode sumnode) {
1113 MySet<Edge> newSet=null;
1114 for(Iterator<Edge> edgeit=edgeset.iterator();edgeit.hasNext();) {
1115 Edge e=edgeit.next();
1116 if (e.dst==oldnode||e.src==oldnode) {
1118 newSet=new MySet<Edge>();
1123 if (e.dst==oldnode) {
1126 if (e.src==oldnode) {
1129 if (oldedgeset==null||!oldedgeset.contains(e))
1134 edgeset.addAll(newSet);
1137 /* Shrinks the incoming set to just include rewritten values.
1138 * Returns a set of the original rewritten values */
1140 MySet<Edge> shrinkSet(MySet<Edge> edgeset, MySet<Edge> oldedgeset, AllocNode oldnode, AllocNode newnode) {
1141 MySet<Edge> newSet=null;
1142 MySet<Edge> removeSet=null;
1143 for(Iterator<Edge> edgeit=edgeset.iterator();edgeit.hasNext();) {
1144 Edge e=edgeit.next();
1146 if (e.dst==oldnode||e.src==oldnode) {
1148 newSet=new MySet<Edge>();
1149 removeSet=new MySet<Edge>();
1152 removeSet.add(e.copy());
1157 if (oldedgeset==null||!oldedgeset.contains(e))
1162 edgeset.addAll(newSet);
1166 /* This function returns a completely new Delta... It is safe to
1169 Delta applyInitDelta(Delta delta, BBlock block) {
1170 //Apply delta to graph
1171 boolean newGraph=false;
1172 if (!bbgraphMap.containsKey(block)) {
1173 bbgraphMap.put(block, new Graph(null));
1177 Graph graph=bbgraphMap.get(block);
1180 newdelta=new Delta(null, true);
1181 //Add in heap edges and throw away original diff
1182 graph.nodeMap.putAll(delta.heapedgeadd);
1183 //Add in var edges and throw away original diff
1184 graph.varMap.putAll(delta.varedgeadd);
1185 //Record that this is initial set...
1186 graph.nodeAges.addAll(delta.addNodeAges);
1188 for(Map.Entry<AllocNode, Boolean> oldentry:delta.addOldNodes.entrySet()) {
1189 if (oldentry.getValue().booleanValue()) {
1190 graph.oldNodes.put(oldentry.getKey(), Boolean.TRUE);
1194 newdelta=new Delta(null, false);
1195 //merge in heap edges and variables
1196 mergeHeapEdges(graph, delta, newdelta);
1197 mergeVarEdges(graph, delta, newdelta);
1198 mergeAges(graph, delta, newdelta);
1203 /* This function merges in the heap edges. It updates delta to be
1206 void mergeHeapEdges(Graph graph, Delta delta, Delta newdelta) {
1208 for(Map.Entry<AllocNode, MySet<Edge>> heapedge:delta.heapedgeadd.entrySet()) {
1209 AllocNode nsrc=heapedge.getKey();
1210 MySet<Edge> edges=heapedge.getValue();
1212 if (graph.backMap!=null) {
1214 if (!graph.backMap.containsKey(e.dst))
1215 graph.backMap.put(e.dst, new MySet<Edge>());
1216 graph.backMap.get(e.dst).add(e);
1220 if (!graph.nodeMap.containsKey(nsrc)) {
1221 graph.nodeMap.put(nsrc, new MySet<Edge>());
1223 MySet<Edge> dstedges=graph.nodeMap.get(nsrc);
1224 MySet<Edge> diffedges=new MySet<Edge>();
1226 if (!dstedges.contains(e)) {
1227 //We have a new edge
1232 //Done with edge set...
1233 if (diffedges.size()>0) {
1235 newdelta.baseheapedge.put(nsrc, diffedges);
1240 /* This function merges in the var edges. It updates delta to be
1243 void mergeVarEdges(Graph graph, Delta delta, Delta newdelta) {
1245 for(Map.Entry<TempDescriptor, MySet<Edge>> varedge:delta.varedgeadd.entrySet()) {
1246 TempDescriptor tmpsrc=varedge.getKey();
1247 MySet<Edge> edges=varedge.getValue();
1248 if (graph.backMap!=null) {
1250 if (!graph.backMap.containsKey(e.dst))
1251 graph.backMap.put(e.dst, new MySet<Edge>());
1252 graph.backMap.get(e.dst).add(e);
1256 if (!graph.varMap.containsKey(tmpsrc)) {
1257 graph.varMap.put(tmpsrc, new MySet<Edge>());
1259 MySet<Edge> dstedges=graph.varMap.get(tmpsrc);
1260 MySet<Edge> diffedges=new MySet<Edge>();
1262 if (!dstedges.contains(e)) {
1263 //We have a new edge
1268 //Done with edge set...
1269 if (diffedges.size()>=0) {
1271 newdelta.basevaredge.put(tmpsrc,diffedges);
1276 void mergeAges(Graph graph, Delta delta, Delta newDelta) {
1278 for(AllocNode node:delta.addNodeAges) {
1279 if (!graph.nodeAges.contains(node)) {
1280 graph.nodeAges.add(node);
1281 newDelta.baseNodeAges.add(node);
1284 for(Map.Entry<AllocNode, Boolean> oldentry:delta.addOldNodes.entrySet()) {
1285 AllocNode node=oldentry.getKey();
1286 boolean ispresent=oldentry.getValue().booleanValue();
1287 if (ispresent&&!graph.oldNodes.containsKey(node)) {
1288 graph.oldNodes.put(node, Boolean.TRUE);
1289 newDelta.baseOldNodes.put(node, Boolean.TRUE);