if( hasHash ) {
if( oldHash != hash ) {
- throw new Error("A CANONICAL HASH CHANGED");
+ throw new Error("A CANONICAL HASH CHANGED");
}
} else {
hasHash = true;
rt1.isOutOfContext()
);
if( rt2 != null ) {
- out.reachTuples.add(unionUpArity(rt1, rt2) );
+ out.reachTuples.add(unionUpArity(rt1, rt2) );
} else {
- out.reachTuples.add(rt1);
+ out.reachTuples.add(rt1);
}
}
rt2.isOutOfContext()
);
if( rt1 == null ) {
- out.reachTuples.add(rt2);
+ out.reachTuples.add(rt2);
}
}
if( age == AllocSite.AGE_notInThisSite ||
rt.isOutOfContext()
) {
- out.reachTuples.add(rt);
+ out.reachTuples.add(rt);
} else if( age == AllocSite.AGE_summary ) {
- // remember the summary tuple, but don't add it
- // we may combine it with the oldest tuple
- rtSummary = rt;
+ // remember the summary tuple, but don't add it
+ // we may combine it with the oldest tuple
+ rtSummary = rt;
} else if( age == AllocSite.AGE_oldest ) {
- // found an oldest hrnID, again just remember
- // for later
- rtOldest = rt;
+ // found an oldest hrnID, again just remember
+ // for later
+ rtOldest = rt;
} else {
- assert age == AllocSite.AGE_in_I;
+ assert age == AllocSite.AGE_in_I;
- Integer I = as.getAge(hrnID);
- assert I != null;
+ Integer I = as.getAge(hrnID);
+ assert I != null;
- // otherwise, we change this hrnID to the
- // next older hrnID
- Integer hrnIDToChangeTo = as.getIthOldest(I + 1);
- ReachTuple rtAged =
- Canonical.changeHrnIDTo(rt, hrnIDToChangeTo);
- out.reachTuples.add(rtAged);
+ // otherwise, we change this hrnID to the
+ // next older hrnID
+ Integer hrnIDToChangeTo = as.getIthOldest(I + 1);
+ ReachTuple rtAged =
+ Canonical.changeHrnIDTo(rt, hrnIDToChangeTo);
+ out.reachTuples.add(rtAged);
}
}
ReachState state2 = rs2.containsIgnorePreds(state1);
if( state2 != null ) {
- out.reachStates.add(ReachState.factory(state1.reachTuples,
- Canonical.join(state1.preds,
- state2.preds
- )
- ) );
+ out.reachStates.add(ReachState.factory(state1.reachTuples,
+ Canonical.join(state1.preds,
+ state2.preds
+ )
+ ) );
} else {
- out.reachStates.add(state1);
+ out.reachStates.add(state1);
}
}
ReachState state1 = rs1.containsIgnorePreds(state2);
if( state1 == null ) {
- out.reachStates.add(state2);
+ out.reachStates.add(state2);
}
}
ReachState state1 = (ReachState) itr.next();
ReachState state2 = rs2.containsIgnorePreds(state1);
if( state2 != null ) {
- // prefer the predicates on state1, an overapproximation
- // of state1 preds AND state2 preds
- out.reachStates.add(state1);
+ // prefer the predicates on state1, an overapproximation
+ // of state1 preds AND state2 preds
+ out.reachStates.add(state1);
}
}
Iterator<ChangeTuple> ctItr = cs.iterator();
while( ctItr.hasNext() ) {
- ChangeTuple ct = ctItr.next();
-
- if( stateOrig.equalsIgnorePreds(ct.getStateToMatch() ) ) {
- // use the new state, but the original predicates
- ReachState stateNew =
- ReachState.factory(ct.getStateToAdd().reachTuples,
- stateOrig.preds
- );
- out.reachStates.add(stateNew);
- changeFound = true;
- }
+ ChangeTuple ct = ctItr.next();
+
+ if( stateOrig.equalsIgnorePreds(ct.getStateToMatch() ) ) {
+ // use the new state, but the original predicates
+ ReachState stateNew =
+ ReachState.factory(ct.getStateToAdd().reachTuples,
+ stateOrig.preds
+ );
+ out.reachStates.add(stateNew);
+ changeFound = true;
+ }
}
if( keepSourceState || !changeFound ) {
- out.reachStates.add(stateOrig);
+ out.reachStates.add(stateOrig);
}
}
Iterator<ReachState> itrR = rsR.iterator();
while( itrR.hasNext() ) {
- ReachState r = itrR.next();
-
- ReachState theUnion = ReachState.factory();
-
- Iterator<ReachTuple> itrRelement = r.iterator();
- while( itrRelement.hasNext() ) {
- ReachTuple rtR = itrRelement.next();
- ReachTuple rtO = o.containsHrnID(rtR.getHrnID(),
- rtR.isOutOfContext()
- );
- if( rtO != null ) {
- theUnion = Canonical.add(theUnion,
- Canonical.unionUpArity(rtR,
- rtO
- )
- );
- } else {
- theUnion = Canonical.add(theUnion,
- rtR
- );
- }
- }
-
- Iterator<ReachTuple> itrOelement = o.iterator();
- while( itrOelement.hasNext() ) {
- ReachTuple rtO = itrOelement.next();
- ReachTuple rtR = theUnion.containsHrnID(rtO.getHrnID(),
- rtO.isOutOfContext()
- );
- if( rtR == null ) {
- theUnion = Canonical.add(theUnion,
- rtO
- );
- }
- }
-
- if( !theUnion.isEmpty() ) {
- out =
- Canonical.union(out,
- ChangeSet.factory(
- ChangeTuple.factory(o, theUnion)
- )
- );
- }
+ ReachState r = itrR.next();
+
+ ReachState theUnion = ReachState.factory();
+
+ Iterator<ReachTuple> itrRelement = r.iterator();
+ while( itrRelement.hasNext() ) {
+ ReachTuple rtR = itrRelement.next();
+ ReachTuple rtO = o.containsHrnID(rtR.getHrnID(),
+ rtR.isOutOfContext()
+ );
+ if( rtO != null ) {
+ theUnion = Canonical.add(theUnion,
+ Canonical.unionUpArity(rtR,
+ rtO
+ )
+ );
+ } else {
+ theUnion = Canonical.add(theUnion,
+ rtR
+ );
+ }
+ }
+
+ Iterator<ReachTuple> itrOelement = o.iterator();
+ while( itrOelement.hasNext() ) {
+ ReachTuple rtO = itrOelement.next();
+ ReachTuple rtR = theUnion.containsHrnID(rtO.getHrnID(),
+ rtO.isOutOfContext()
+ );
+ if( rtR == null ) {
+ theUnion = Canonical.add(theUnion,
+ rtO
+ );
+ }
+ }
+
+ if( !theUnion.isEmpty() ) {
+ out =
+ Canonical.union(out,
+ ChangeSet.factory(
+ ChangeTuple.factory(o, theUnion)
+ )
+ );
+ }
}
}
Iterator<ReachState> itrP = rsP.iterator();
while( itrP.hasNext() && !subsetExists ) {
- ReachState stateP = itrP.next();
+ ReachState stateP = itrP.next();
- if( stateP.isSubset(stateO) ) {
- subsetExists = true;
- }
+ if( stateP.isSubset(stateO) ) {
+ subsetExists = true;
+ }
}
if( subsetExists ) {
- out.reachStates.add(stateO);
+ out.reachStates.add(stateO);
}
}
int age = as.getAgeCategory(rt.getHrnID() );
if( age == AllocSite.AGE_notInThisSite ) {
- // things not from the site just go back in
- baseState = Canonical.addUpArity(baseState, rt);
+ // things not from the site just go back in
+ baseState = Canonical.addUpArity(baseState, rt);
} else if( age == AllocSite.AGE_summary ) {
- if( rt.isOutOfContext() ) {
- // if its out-of-context, we only deal here with the ZERO-OR-MORE
- // arity, if ARITY-ONE we'll branch the base state after the loop
- if( rt.getArity() == ReachTuple.ARITY_ZEROORMORE ) {
- // add two overly conservative symbols to reach state (PUNTING)
-
- baseState = Canonical.addUpArity(baseState,
- ReachTuple.factory(as.getSummary(),
- true, // multi
- ReachTuple.ARITY_ZEROORMORE,
- false // out-of-context
- )
- );
-
- baseState = Canonical.addUpArity(baseState,
- ReachTuple.factory(as.getSummary(),
- true, // multi
- ReachTuple.ARITY_ZEROORMORE,
- true // out-of-context
- )
- );
- } else {
- assert rt.getArity() == ReachTuple.ARITY_ONE;
- found2Sooc = true;
- }
-
- } else {
- // the in-context just becomes shadow
- baseState = Canonical.addUpArity(baseState,
- ReachTuple.factory(as.getSummaryShadow(),
- true, // multi
- rt.getArity(),
- false // out-of-context
- )
- );
- }
+ if( rt.isOutOfContext() ) {
+ // if its out-of-context, we only deal here with the ZERO-OR-MORE
+ // arity, if ARITY-ONE we'll branch the base state after the loop
+ if( rt.getArity() == ReachTuple.ARITY_ZEROORMORE ) {
+ // add two overly conservative symbols to reach state (PUNTING)
+
+ baseState = Canonical.addUpArity(baseState,
+ ReachTuple.factory(as.getSummary(),
+ true, // multi
+ ReachTuple.ARITY_ZEROORMORE,
+ false // out-of-context
+ )
+ );
+
+ baseState = Canonical.addUpArity(baseState,
+ ReachTuple.factory(as.getSummary(),
+ true, // multi
+ ReachTuple.ARITY_ZEROORMORE,
+ true // out-of-context
+ )
+ );
+ } else {
+ assert rt.getArity() == ReachTuple.ARITY_ONE;
+ found2Sooc = true;
+ }
+
+ } else {
+ // the in-context just becomes shadow
+ baseState = Canonical.addUpArity(baseState,
+ ReachTuple.factory(as.getSummaryShadow(),
+ true, // multi
+ rt.getArity(),
+ false // out-of-context
+ )
+ );
+ }
} else {
- // otherwise age is in range [0, k]
- Integer I = as.getAge(rt.getHrnID() );
- assert I != null;
- assert !rt.isMultiObject();
- assert rt.getArity() == ReachTuple.ARITY_ONE;
-
- if( rt.isOutOfContext() ) {
- // becomes the in-context version
- baseState = Canonical.addUpArity(baseState,
- ReachTuple.factory(rt.getHrnID(),
- false, // multi
- ReachTuple.ARITY_ONE,
- false // out-of-context
- )
- );
-
- } else {
- // otherwise the ith symbol becomes shadowed
- baseState = Canonical.addUpArity(baseState,
- ReachTuple.factory(-rt.getHrnID(),
- false, // multi
- ReachTuple.ARITY_ONE,
- false // out-of-context
- )
- );
- }
+ // otherwise age is in range [0, k]
+ Integer I = as.getAge(rt.getHrnID() );
+ assert I != null;
+ assert !rt.isMultiObject();
+ assert rt.getArity() == ReachTuple.ARITY_ONE;
+
+ if( rt.isOutOfContext() ) {
+ // becomes the in-context version
+ baseState = Canonical.addUpArity(baseState,
+ ReachTuple.factory(rt.getHrnID(),
+ false, // multi
+ ReachTuple.ARITY_ONE,
+ false // out-of-context
+ )
+ );
+
+ } else {
+ // otherwise the ith symbol becomes shadowed
+ baseState = Canonical.addUpArity(baseState,
+ ReachTuple.factory(-rt.getHrnID(),
+ false, // multi
+ ReachTuple.ARITY_ONE,
+ false // out-of-context
+ )
+ );
+ }
}
}
);
for( int i = 0; i < as.getAllocationDepth(); ++i ) {
- out = Canonical.add(out,
- Canonical.addUpArity(baseState,
- ReachTuple.factory(as.getIthOldest(i),
- false, // multi
- ReachTuple.ARITY_ONE,
- true // out-of-context
- )
- )
- );
+ out = Canonical.add(out,
+ Canonical.addUpArity(baseState,
+ ReachTuple.factory(as.getIthOldest(i),
+ false, // multi
+ ReachTuple.ARITY_ONE,
+ true // out-of-context
+ )
+ )
+ );
}
} else {
int age = as.getShadowAgeCategory(rt.getHrnID() );
if( age == AllocSite.SHADOWAGE_notInThisSite ) {
- // things not from the site just go back in
- out = Canonical.addUpArity(out, rt);
+ // things not from the site just go back in
+ out = Canonical.addUpArity(out, rt);
} else {
- assert !rt.isOutOfContext();
-
- // otherwise unshadow it
- out = Canonical.addUpArity(out,
- ReachTuple.factory(-rt.getHrnID(),
- rt.isMultiObject(),
- rt.getArity(),
- false
- )
- );
+ assert !rt.isOutOfContext();
+
+ // otherwise unshadow it
+ out = Canonical.addUpArity(out,
+ ReachTuple.factory(-rt.getHrnID(),
+ rt.isMultiObject(),
+ rt.getArity(),
+ false
+ )
+ );
}
}
Taint t2 = ts2.containsIgnorePreds(t1);
if( t2 != null ) {
- Taint tNew = new Taint(t1);
- tNew.preds = Canonical.join(t1.preds,
- t2.preds
- );
- tNew = (Taint) makeCanonical(tNew);
- out.taints.add(tNew);
+ Taint tNew = new Taint(t1);
+ tNew.preds = Canonical.join(t1.preds,
+ t2.preds
+ );
+ tNew = (Taint) makeCanonical(tNew);
+ out.taints.add(tNew);
} else {
- out.taints.add(t1);
+ out.taints.add(t1);
}
}
Taint t1 = ts1.containsIgnorePreds(t2);
if( t1 == null ) {
- out.taints.add(t2);
+ out.taints.add(t2);
}
}
Taint t2 = ts2.containsIgnorePreds(t1);
if( t2 != null ) {
- Taint tNew = new Taint(t1);
- tNew.preds = Canonical.join(t1.preds,
- t2.preds
- );
- tNew = (Taint) makeCanonical(tNew);
- out.taints.add(tNew);
+ Taint tNew = new Taint(t1);
+ tNew.preds = Canonical.join(t1.preds,
+ t2.preds
+ );
+ tNew = (Taint) makeCanonical(tNew);
+ out.taints.add(tNew);
} else {
- out.taints.add(t1);
+ out.taints.add(t1);
}
}
Taint t1 = ts1.containsIgnorePreds(t2);
if( t1 == null ) {
- out.taints.add(t2);
+ out.taints.add(t2);
}
}
!t.getSESE().equals(sese) ||
!t.getPreds().isEmpty()
) {
- out.taints.add(t);
+ out.taints.add(t);
}
}
// it is out of context so it should go through, too
if( t.getSESE() == null ||
!seseSet.contains(t)) {
- out.taints.add(t);
+ out.taints.add(t);
}
}
// unaffected, and if the taint has a non-empty predicate
// it is out of context so it should go through, too
if( t.getSESE()!=null && t.getSESE()!=sese) {
- out.taints.add(t);
+ out.taints.add(t);
}
}
// only take non-stall site taints onward
if( t.getStallSite() == null ) {
- out.taints.add(t);
+ out.taints.add(t);
}
}