for(int i=0;i<pm.numNext(fn);i++) {
FlatNode fnext=pm.getNext(fn,i);
if (!map.containsKey(fnext)) {
- map.put(fn, new BBlock());
- toprocess.add(fn);
+ map.put(fnext, new BBlock());
+ toprocess.add(fnext);
}
//link block in
- if (!block.nextb.contains(map.get(fn))) {
- block.nextb.add(map.get(fn));
- map.get(fn).prevb.add(block);
+ if (!block.nextb.contains(map.get(fnext))) {
+ block.nextb.add(map.get(fnext));
+ map.get(fnext).prevb.add(block);
}
}
break;
this.block=block;
}
+ public void print() {
+ System.out.println("----------------------------------------------");
+ System.out.println("baseheapedge empty:"+baseheapedge.isEmpty());
+ System.out.println("basevaredge empty:"+basevaredge.isEmpty());
+ System.out.println("heapedgeadd empty:"+heapedgeadd.isEmpty());
+ System.out.println("heapedgeremove empty:"+heapedgeremove.isEmpty());
+ System.out.println("varedgeadd empty:"+varedgeadd.isEmpty());
+ if (varedgeremove==null)
+ System.out.println("varedge remove: null");
+ else
+ System.out.println("varedgeremove empty:"+varedgeremove.isEmpty());
+ System.out.println("baseNodeAges empty:"+baseNodeAges.isEmpty());
+ System.out.println("addNodeAges empty:"+addNodeAges.isEmpty());
+ System.out.println("baseOldNodes empty:"+baseOldNodes.isEmpty());
+ System.out.println("addOldNodes empty:"+addOldNodes.isEmpty());
+ }
+
private Delta() {
}
MySet<Edge> edges=varMap.get(old.srcvar);
if (edges==null)
edges=parent.varMap.get(old.srcvar);
+ if (edges==null)
+ return null;
return edges.get(old);
} else {
MySet<Edge> edges=nodeMap.get(old.src);
if (edges==null)
edges=parent.nodeMap.get(old.src);
+ if (edges==null)
+ return null;
return edges.get(old);
}
}
HashSet<AllocNode> nodes=new HashSet<AllocNode>();
for(AllocNode node:srcNodes) {
MySet<Edge> 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);
- }
+ MySet<Edge> baseEdges=delta.baseheapedge.get(node);
+ if (baseEdges!=null)
+ for(Edge e:baseEdges) {
+ if (e.fd==fd&&(removeedges==null||!removeedges.contains(e)))
+ nodes.add(e.dst);
+ }
if (delta.heapedgeadd.containsKey(node))
for(Edge e:delta.heapedgeadd.get(node)) {
if (e.fd==fd)
public void doAnalysis() {
toprocess.add(buildInitialContext());
-
while(!toprocess.isEmpty()) {
Delta delta=toprocess.remove();
+ delta.print();
PPoint ppoint=delta.getBlock();
BBlock bblock=ppoint.getBBlock();
Vector<FlatNode> nodes=bblock.nodes();
/* Now we need to propagate newdelta */
if (!newDelta.heapedgeadd.isEmpty()||!newDelta.heapedgeremove.isEmpty()||!newDelta.varedgeadd.isEmpty()||!newDelta.addNodeAges.isEmpty()||!newDelta.addOldNodes.isEmpty()) {
/* We have a delta to propagate */
-
if (returnMap.containsKey(bblock)) {
//exit of call block
boolean first=true;
return processSetFieldElementNode(node, delta, newgraph);
case FKind.FlatMethod:
case FKind.FlatExit:
+ case FKind.FlatBackEdge:
case FKind.FlatGenReachNode:
return processFlatNop(node, delta, newgraph);
case FKind.FlatCall:
} else {
//Generate diff from parent graph
MySet<Edge> parentedges=graph.parent.nodeMap.get(node);
- MySet<Edge> newedgeset=Util.setSubtract(parentedges, edgestoremove);
- graph.nodeMap.put(node, newedgeset);
+ if (parentedges!=null) {
+ MySet<Edge> newedgeset=Util.setSubtract(parentedges, edgestoremove);
+ graph.nodeMap.put(node, newedgeset);
+ }
}
}
map.get(key).removeAll(toremove);
map.get(key).addAll(toadd);
} else {
- map.put(key, (MySet<V>) toadd.clone());
+ if (toadd!=null)
+ map.put(key, (MySet<V>) toadd.clone());
}
}