return out;
}
+
+ public static TaintSet addPTR( TaintSet ts,
+ Taint t ) {
+ return add(ts, t);
+ }
+
public static TaintSet union( TaintSet ts1,
TaintSet ts2 ) {
assert ts1 != null;
return out;
}
+ public static TaintSet unionPTR( TaintSet ts1,
+ TaintSet ts2 ) {
+ assert ts1 != null;
+ assert ts2 != null;
+ assert ts1.isCanonical();
+ assert ts2.isCanonical();
+
+ CanonicalOp op =
+ new CanonicalOp( CanonicalOp.TAINTSET_UNION_TAINTSET,
+ ts1,
+ ts2 );
+
+ Canonical result = op2result.get( op );
+ if( result != null ) {
+ return (TaintSet) result;
+ }
+
+ // otherwise, no cached result...
+ TaintSet out = new TaintSet();
+
+ out.taints.addAll(ts1.taints);
+ out.taints.addAll(ts2.taints);
+ out= (TaintSet) Canonical.makeCanonical(out);
+ op2result.put( op, out );
+ return out;
+ }
+
public static TaintSet unionORpreds( TaintSet ts1,
TaintSet ts2 ) {
assert ts1 != null;
}
public TaintSet add(Taint t) {
- TaintSet newt=new TaintSet();
+ return Canonical.addPTR(this, t);
+ /* TaintSet newt=new TaintSet();
newt.taints.addAll(taints);
newt.taints.add(t);
- return (TaintSet) Canonical.makeCanonical(newt);
+ return (TaintSet) Canonical.makeCanonical(newt);*/
}
public TaintSet merge(TaintSet ts) {
- TaintSet newt=new TaintSet();
+ return Canonical.unionPTR(this, ts);
+ /* TaintSet newt=new TaintSet();
newt.taints.addAll(taints);
newt.taints.addAll(ts.taints);
- return (TaintSet) Canonical.makeCanonical(newt);
+ return (TaintSet) Canonical.makeCanonical(newt);*/
}
protected TaintSet() {
}
public String toString() {
- return taints.toString();
+ String s = "taints[";
+
+ Iterator<Taint> tItr = taints.iterator();
+ while( tItr.hasNext() ) {
+ Taint t = tItr.next();
+ if (t.toString().indexOf("applyCavity")!=-1) {
+ s += t.toString();
+ if( tItr.hasNext() ) {
+ s += ",\\n";
+ }
+ }
+ }
+ s += "]";
+ return s;
+ // return taints.toString();
}
}
}
//Neither is null
//Do a set comparison
-
- return ts1.getTaints().containsAll(ts2.getTaints());
+ //do merge + equals...faster than subset...
+ TaintSet tsmerge=ts1.merge(ts2);
+ return tsmerge.equals(ts1);
}
public static boolean subsumes(int status1, int status2) {