1 package Analysis.Pointer;
4 import Analysis.Pointer.AllocFactory.AllocNode;
12 public static final int SNGSNG=1;
13 public static final int SNGSUM=2;
14 public static final int SUMSNG=4;
15 public static final int SUMSUM=8;
16 public static final int NEW=16;
18 public static int mergeStatus(int stat1, int stat2) {
19 int status=stat1|stat2;
20 return ((status&NEW)==NEW)?NEW:status;
26 public Edge(AllocNode src, FieldDescriptor fd, AllocNode dst) {
32 public Edge(AllocNode src, FieldDescriptor fd, AllocNode dst, int statuspredicate) {
36 this.statuspredicate=statuspredicate;
39 public Edge(TempDescriptor tmp, AllocNode dst) {
44 public int hashCode() {
45 int hashcode=dst.hashCode();
47 hashcode^=fd.hashCode();
50 hashcode^=(src.hashCode()<<3);
52 hashcode^=(srcvar.hashCode()<<3);
57 public boolean equals(Object o) {
58 if (o instanceof Edge) {
61 return (srcvar==e.srcvar)&&(dst==e.dst);
63 return (src==e.src)&&(dst==e.dst)&&(fd==e.fd);
75 e.statuspredicate=statuspredicate;
79 public Edge merge(Edge e) {
83 newe.statuspredicate=mergeStatus(statuspredicate, e.statuspredicate);
87 public Edge rewrite(AllocNode single, AllocNode summary) {
96 public boolean statusDominates(Edge other) {
97 return (statuspredicate==NEW)||
98 ((other.statuspredicate|statuspredicate)==statuspredicate);
101 public Edge makeStatus(AllocFactory factory) {
104 e.src=factory.getAllocNode(src, (statuspredicate|3)==0);
105 e.dst=factory.getAllocNode(dst, (statuspredicate|5)==0);
109 public boolean subsumes(Edge e) {
110 return subsumes(this.statuspredicate, e.statuspredicate);
113 public static boolean subsumes(int status1, int status2) {
114 return ((status1&NEW)==NEW)&&((status1|status2)==status1);
117 public Edge makeOld() {
128 e.statuspredicate=val;