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;
21 /* Init is set for false for delta propagations inside of one basic block.
24 public Delta(PPoint block, boolean init) {
26 this.baseheapedge=new HashMap<AllocNode, MySet<Edge>>();
27 this.basevaredge=new HashMap<TempDescriptor, MySet<Edge>>();
28 this.heapedgeadd=new HashMap<AllocNode, MySet<Edge>>();
29 this.heapedgeremove=new HashMap<AllocNode, MySet<Edge>>();
30 this.varedgeadd=new HashMap<TempDescriptor, MySet<Edge>>();
31 this.varedgeremove=new HashMap<TempDescriptor, MySet<Edge>>();
32 this.baseNodeAges=new HashSet<AllocNode>();
33 this.addNodeAges=new HashSet<AllocNode>();
40 public PPoint getBlock() {
44 public void setBlock(PPoint block) {
48 public Delta changeParams(HashMap<TempDescriptor, TempDescriptor> tmpMap, PPoint bblock) {
49 Delta newdelta=new Delta();
50 newdelta.baseheapedge=baseheapedge;
51 newdelta.basevaredge=basevaredge;
52 newdelta.heapedgeadd=heapedgeadd;
53 newdelta.heapedgeremove=heapedgeremove;
54 //Update variable edge mappings
55 newdelta.varedgeadd=new HashMap<TempDescriptor, MySet<Edge>>();
56 for(Map.Entry<TempDescriptor, MySet<Edge>> entry:varedgeadd.entrySet()) {
57 varedgeadd.put(tmpMap.get(entry.getKey()), entry.getValue());
59 newdelta.varedgeremove=varedgeremove;
60 newdelta.block=bblock;
64 public Delta buildBase(MySet<Edge> edges) {
65 Delta newdelta=new Delta();
66 newdelta.baseheapedge=baseheapedge;
67 newdelta.basevaredge=basevaredge;
68 newdelta.heapedgeadd=heapedgeadd;
69 newdelta.heapedgeremove=heapedgeremove;
70 newdelta.varedgeadd=varedgeadd;
73 if (!newdelta.varedgeadd.containsKey(e.srcvar)) {
74 newdelta.varedgeadd.put(e.srcvar, new MySet<Edge>());
76 newdelta.varedgeadd.get(e.srcvar).add(e);
78 if (!newdelta.heapedgeadd.containsKey(e.src)) {
79 newdelta.heapedgeadd.put(e.src, new MySet<Edge>());
81 newdelta.heapedgeadd.get(e.src).add(e);
87 public Delta diffBlock(PPoint bblock) {
88 Delta newdelta=new Delta();
89 newdelta.baseheapedge=baseheapedge;
90 newdelta.basevaredge=basevaredge;
91 newdelta.heapedgeadd=heapedgeadd;
92 newdelta.heapedgeremove=heapedgeremove;
93 newdelta.varedgeadd=varedgeadd;
94 newdelta.varedgeremove=varedgeremove;
95 newdelta.block=bblock;
99 public boolean getInit() {
103 public void setInit(boolean init) {