use of soot.PointsToSet in project soot by Sable.
the class DemandCSPointsTo method consistentResult.
/**
* Returns <code>false</code> if an inconsistent computation occurred, i.e. if result
* differs from the result computed by {@link #computeReachingObjects(Local)} on l.
*/
private boolean consistentResult(Local l, PointsToSet result) {
PointsToSet result2 = computeReachingObjects(l);
if (!(result instanceof EqualsSupportingPointsToSet) || !(result2 instanceof EqualsSupportingPointsToSet)) {
// cannot compare, assume everything is fine
return true;
}
EqualsSupportingPointsToSet eq1 = (EqualsSupportingPointsToSet) result;
EqualsSupportingPointsToSet eq2 = (EqualsSupportingPointsToSet) result2;
return new PointsToSetEqualsWrapper(eq1).equals(new PointsToSetEqualsWrapper(eq2));
}
use of soot.PointsToSet in project soot by Sable.
the class DemandCSPointsTo method computeRefinedReachingObjects.
/**
* Computes the refined set of reaching objects for l.
* Returns <code>null</code> if refinement failed.
*/
protected PointsToSet computeRefinedReachingObjects(VarNode v) {
// must reset the refinement heuristic for each query
this.fieldCheckHeuristic = HeuristicType.getHeuristic(heuristicType, pag.getTypeManager(), getMaxPasses());
doPointsTo = true;
numPasses = 0;
PointsToSet contextSensitiveResult = null;
while (true) {
numPasses++;
if (DEBUG_PASS != -1 && numPasses > DEBUG_PASS) {
break;
}
if (numPasses > maxPasses) {
break;
}
if (DEBUG) {
logger.debug("PASS " + numPasses);
logger.debug("" + fieldCheckHeuristic);
}
clearState();
pointsTo = new AllocAndContextSet();
try {
refineP2Set(new VarAndContext(v, EMPTY_CALLSTACK), null);
contextSensitiveResult = pointsTo;
} catch (TerminateEarlyException e) {
}
if (!fieldCheckHeuristic.runNewPass()) {
break;
}
}
return contextSensitiveResult;
}
use of soot.PointsToSet in project soot by Sable.
the class DemandCSPointsTo method doReachingObjects.
public PointsToSet doReachingObjects(Local l) {
// lazy initialization
if (fieldToStores == null) {
init();
}
PointsToSet result;
Map<Local, PointsToSet> cache;
if (refineCallGraph) {
// we use different caches for different settings
cache = reachingObjectsCache;
} else {
cache = reachingObjectsCacheNoCGRefinement;
}
result = cache.get(l);
if (result == null) {
result = computeReachingObjects(l);
if (useCache) {
cache.put(l, result);
}
}
assert consistentResult(l, result);
return result;
}
use of soot.PointsToSet in project soot by Sable.
the class LazyContextSensitivePointsToSet method hasNonEmptyIntersection.
public boolean hasNonEmptyIntersection(PointsToSet other) {
PointsToSet otherInner;
if (other instanceof LazyContextSensitivePointsToSet)
otherInner = ((LazyContextSensitivePointsToSet) other).delegate;
else
otherInner = other;
if (delegate.hasNonEmptyIntersection(otherInner)) {
if (other instanceof LazyContextSensitivePointsToSet) {
((LazyContextSensitivePointsToSet) other).computeContextSensitiveInfo();
otherInner = ((LazyContextSensitivePointsToSet) other).delegate;
}
computeContextSensitiveInfo();
return delegate.hasNonEmptyIntersection(otherInner);
} else {
return false;
}
}
use of soot.PointsToSet in project soot by Sable.
the class GeomQueries method isAliasCI.
/**
* Are the two pointers an alias with context insensitive points-to information?
*/
public boolean isAliasCI(Local l1, Local l2) {
PointsToSet pts1 = geomPTA.reachingObjects(l1);
PointsToSet pts2 = geomPTA.reachingObjects(l2);
return pts1.hasNonEmptyIntersection(pts2);
}
Aggregations