1 package Analysis.Disjoint;
10 public class DefiniteReachAnalysis {
14 // Maps variables and an edge (x, y, e) to an unused value when the
15 // object of x is already reachable from the object of y, and the
16 // set of edges conservatively gives the path.
17 // NOTE: Use EdgeKey instead of edges because this analysis's
18 // scope is beyond the scope of a single reach graph.
21 // Just a hashmap of variable to enum (unknown, new).
27 public DefiniteReachAnalysis() {
30 // what are the transfer functions that are relevant for this analyis?
32 public void methodEntry(Set<TempDescriptor> parameters) {
36 // Rs' := P x {unknown}
39 public void copy(TempDescriptor x,
41 // R' := (R - <x,*> - <*,x>) U
42 // {<x,z>->e | <y,z>->e in R} U
43 // {<z,x>->e | <z,y>->e in R}
45 // R'.remove(view0, x);
46 // R'.remove(view1, x);
47 // setYs = R.get(view0, y);
48 // for each <y,z>->e: R'.put(<x,z>, e);
49 // setYs = R.get(view1, y);
50 // for each <z,y>->e: R'.put(<z,x>, e);
52 // Rs' := (Rs - <x,*>) U {<x,v> | <y,v> in Rs}
55 public void load(TempDescriptor x,
58 // R' := (R - <x,*> - <*,x>) U
59 // ({<x,y>} x Eo(y,f)) U
60 // U {<x,z>} x (Eo(y,f)U{e})
63 // R'.remove(view0, x);
64 // R'.remove(view1, x);
65 // R'.put(<x,y>, eee!);
66 // setYs = R.get(view0, y);
67 // for each <y,z>->e: R'.put(<x,z>, eee!Ue);
69 // Rs' := (Rs - <x,*>) U {<x, unknown>}
72 public void store(TempDescriptor x,
75 // I think this should be if there is ANY <w,z>->e' IN Eremove, then kill all <w,z>
76 // R' := (R - {<w,z>->e | <w,z>->e in R, A<w,z>->e' in R, e' notin Eremove}) U
77 // {<y,x>->e | e in E(x) x {f} x E(y)}
79 // R'.remove(?); some e's...
80 // R'.put(<y,x>, E(x) x {f} x E(y));
85 public void newObject(TempDescriptor x) {
86 // R' := (R - <x,*> - <*,x>)
88 // R'.remove(view0, x);
89 // R'.remove(view1, x);
91 // Rs' := (Rs - <x,*>) U {<x, new>}
94 public void methodCall(TempDescriptor x) {
95 // R' := (R - <x,*> - <*,x>)
97 // R'.remove(view0, x);
98 // R'.remove(view1, x);
100 // Rs' := (Rs - <x,*>) U {<x, unknown>}
103 public void merge() {
104 // R' := <x,y>->e iff its in all incoming edges
106 // Rs' := <x, new> iff in all incoming edges, otherwie <x, unknown>