1 package Analysis.Disjoint;
8 ///////////////////////////////////////////
10 // This class is an immutable Canonical, so
12 // 0) construct them with a factory pattern
13 // to ensure only canonical versions escape
15 // 1) any operation that modifies a Canonical
16 // is a static method in the Canonical class
18 // 2) operations that just read this object
19 // should be defined here
21 // 3) every Canonical subclass hashCode should
22 // throw an error if the hash ever changes
24 ///////////////////////////////////////////
26 // a taint is applied to a reference edge, and
27 // is used to associate an effect with a heap root
29 public class Taint extends Canonical {
31 // taints can either be associated with
32 // parameters or seses (rblocks),
33 // only one set of identifying objects
36 // identify a parameter index
37 protected Integer paramIndex;
39 // identify an sese (rblock) + inset var
40 protected FlatSESEEnterNode sese;
41 protected TempDescriptor insetVar;
43 // either type of taint also includes
45 protected AllocSite allocSite;
48 public static Taint factory( Integer pi,
52 Taint out = new Taint( pi, s, iv, as );
53 out = (Taint) Canonical.makeCanonical( out );
57 protected Taint( Integer pi,
62 (pi != null && s == null && iv == null) ||
63 (pi == null && s != null && iv != null);
73 public Integer getParamIndex() {
77 public FlatSESEEnterNode getSESE() {
81 public TempDescriptor getInSetVar() {
85 public AllocSite getAllocSite() {
90 public boolean equalsSpecific( Object o ) {
95 if( !(o instanceof Taint) ) {
101 boolean piMatches = true;
102 if( paramIndex == null ) {
103 piMatches = t.paramIndex == null;
105 piMatches = paramIndex.equals( t.paramIndex );
108 boolean sMatches = true;
110 sMatches = t.sese == null;
112 sMatches = sese.equals( t.sese );
115 boolean ivMatches = true;
116 if( insetVar == null ) {
117 ivMatches = t.insetVar == null;
119 ivMatches = insetVar.equals( t.insetVar );
122 return allocSite.equals( t.allocSite ) &&
123 piMatches && sMatches && ivMatches;
126 public int hashCodeSpecific() {
127 int hash = allocSite.hashCode();
129 if( paramIndex != null ) {
130 hash = hash ^ paramIndex.hashCode();
134 hash = hash ^ sese.hashCode();
137 if( insetVar != null ) {
138 hash = hash ^ insetVar.hashCode();
144 public String toString() {