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;
23 public boolean isNew() {
24 return (statuspredicate&NEW)==NEW;
30 public Edge(AllocNode src, FieldDescriptor fd, AllocNode dst) {
36 public Edge(AllocNode src, FieldDescriptor fd, AllocNode dst, int statuspredicate) {
40 this.statuspredicate=statuspredicate;
43 public Edge(TempDescriptor tmp, AllocNode dst) {
48 public int hashCode() {
49 int hashcode=dst.hashCode();
51 hashcode^=fd.hashCode();
54 hashcode^=(src.hashCode()<<3);
56 hashcode^=(srcvar.hashCode()<<3);
61 public boolean equals(Object o) {
62 if (o instanceof Edge) {
65 return (srcvar==e.srcvar)&&(dst==e.dst);
67 return (src==e.src)&&(dst==e.dst)&&(fd==e.fd);
79 e.statuspredicate=statuspredicate;
83 public Edge merge(Edge e) {
87 newe.statuspredicate=mergeStatus(statuspredicate, e.statuspredicate);
91 public Edge rewrite(AllocNode single, AllocNode summary) {
100 public boolean statusDominates(Edge other) {
101 return (statuspredicate==NEW)||
102 ((other.statuspredicate|statuspredicate)==statuspredicate);
105 public Edge makeStatus(AllocFactory factory) {
108 e.src=factory.getAllocNode(src, (statuspredicate|3)==0);
109 e.dst=factory.getAllocNode(dst, (statuspredicate|5)==0);
113 public boolean subsumes(Edge e) {
114 return subsumes(this.statuspredicate, e.statuspredicate);
117 public static boolean subsumes(int status1, int status2) {
118 return ((status1&NEW)==NEW)&&((status1|status2)==status1);
121 public Edge makeOld() {
132 e.statuspredicate=val;