1 package Analysis.Pointer;
3 import Analysis.Pointer.AllocFactory.AllocNode;
4 import Analysis.Pointer.BasicBlock.BBlock;
8 HashMap<AllocNode, MySet<Edge>> heapedgeremove;
9 HashMap<AllocNode, MySet<Edge>> heapedgeadd;
10 HashMap<TempDescriptor, MySet<Edge>> varedgeadd;
11 HashMap<TempDescriptor, MySet<Edge>> varedgeremove;
12 HashMap<AllocNode, MySet<Edge>> baseheapedge;
13 HashMap<TempDescriptor, MySet<Edge>> basevaredge;
14 HashSet<AllocNode> baseNodeAges;
15 HashSet<AllocNode> addNodeAges;
16 HashMap<AllocNode, Boolean> baseOldNodes;
17 HashMap<AllocNode, Boolean> addOldNodes;
24 /* Init is set for false for delta propagations inside of one basic block.
27 public Delta(PPoint block, boolean init) {
29 this.baseheapedge=new HashMap<AllocNode, MySet<Edge>>();
30 this.basevaredge=new HashMap<TempDescriptor, MySet<Edge>>();
31 this.heapedgeadd=new HashMap<AllocNode, MySet<Edge>>();
32 this.heapedgeremove=new HashMap<AllocNode, MySet<Edge>>();
33 this.varedgeadd=new HashMap<TempDescriptor, MySet<Edge>>();
34 this.varedgeremove=new HashMap<TempDescriptor, MySet<Edge>>();
35 this.baseNodeAges=new HashSet<AllocNode>();
36 this.addNodeAges=new HashSet<AllocNode>();
37 this.baseOldNodes=new HashMap<AllocNode, Boolean>();
38 this.addOldNodes=new HashMap<AllocNode, Boolean>();
45 public PPoint getBlock() {
49 public void setBlock(PPoint block) {
53 public Delta changeParams(HashMap<TempDescriptor, TempDescriptor> tmpMap, PPoint bblock) {
54 Delta newdelta=new Delta();
55 newdelta.baseheapedge=baseheapedge;
56 newdelta.basevaredge=basevaredge;
57 newdelta.heapedgeadd=heapedgeadd;
58 newdelta.heapedgeremove=heapedgeremove;
59 //Update variable edge mappings
60 newdelta.varedgeadd=new HashMap<TempDescriptor, MySet<Edge>>();
61 for(Map.Entry<TempDescriptor, MySet<Edge>> entry:varedgeadd.entrySet()) {
62 varedgeadd.put(tmpMap.get(entry.getKey()), entry.getValue());
64 newdelta.varedgeremove=varedgeremove;
65 newdelta.block=bblock;
69 public Delta buildBase(MySet<Edge> edges) {
70 Delta newdelta=new Delta();
71 newdelta.baseheapedge=baseheapedge;
72 newdelta.basevaredge=basevaredge;
73 newdelta.heapedgeadd=heapedgeadd;
74 newdelta.heapedgeremove=heapedgeremove;
75 newdelta.varedgeadd=varedgeadd;
78 if (!newdelta.varedgeadd.containsKey(e.srcvar)) {
79 newdelta.varedgeadd.put(e.srcvar, new MySet<Edge>());
81 newdelta.varedgeadd.get(e.srcvar).add(e);
83 if (!newdelta.heapedgeadd.containsKey(e.src)) {
84 newdelta.heapedgeadd.put(e.src, new MySet<Edge>());
86 newdelta.heapedgeadd.get(e.src).add(e);
92 public Delta diffBlock(PPoint bblock) {
93 Delta newdelta=new Delta();
94 newdelta.baseheapedge=baseheapedge;
95 newdelta.basevaredge=basevaredge;
96 newdelta.heapedgeadd=heapedgeadd;
97 newdelta.heapedgeremove=heapedgeremove;
98 newdelta.varedgeadd=varedgeadd;
99 newdelta.varedgeremove=varedgeremove;
100 newdelta.block=bblock;
104 public boolean getInit() {
108 public void setInit(boolean init) {