Search in sources :

Example 1 with PointsToSet

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));
}
Also used : EmptyPointsToSet(soot.jimple.spark.sets.EmptyPointsToSet) EqualsSupportingPointsToSet(soot.jimple.spark.sets.EqualsSupportingPointsToSet) HybridPointsToSet(soot.jimple.spark.sets.HybridPointsToSet) PointsToSet(soot.PointsToSet) EqualsSupportingPointsToSet(soot.jimple.spark.sets.EqualsSupportingPointsToSet) PointsToSetEqualsWrapper(soot.jimple.spark.sets.PointsToSetEqualsWrapper)

Example 2 with PointsToSet

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;
}
Also used : EmptyPointsToSet(soot.jimple.spark.sets.EmptyPointsToSet) EqualsSupportingPointsToSet(soot.jimple.spark.sets.EqualsSupportingPointsToSet) HybridPointsToSet(soot.jimple.spark.sets.HybridPointsToSet) PointsToSet(soot.PointsToSet)

Example 3 with PointsToSet

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;
}
Also used : EmptyPointsToSet(soot.jimple.spark.sets.EmptyPointsToSet) EqualsSupportingPointsToSet(soot.jimple.spark.sets.EqualsSupportingPointsToSet) HybridPointsToSet(soot.jimple.spark.sets.HybridPointsToSet) PointsToSet(soot.PointsToSet) Local(soot.Local)

Example 4 with PointsToSet

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;
    }
}
Also used : PointsToSet(soot.PointsToSet) EqualsSupportingPointsToSet(soot.jimple.spark.sets.EqualsSupportingPointsToSet)

Example 5 with PointsToSet

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);
}
Also used : PointsToSet(soot.PointsToSet)

Aggregations

PointsToSet (soot.PointsToSet)17 Local (soot.Local)5 EqualsSupportingPointsToSet (soot.jimple.spark.sets.EqualsSupportingPointsToSet)5 EmptyPointsToSet (soot.jimple.spark.sets.EmptyPointsToSet)4 HybridPointsToSet (soot.jimple.spark.sets.HybridPointsToSet)4 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 Map (java.util.Map)2 SootField (soot.SootField)2 Type (soot.Type)2 Value (soot.Value)2 ArrayRef (soot.jimple.ArrayRef)2 InstanceFieldRef (soot.jimple.InstanceFieldRef)2 FlowFunction (heros.FlowFunction)1 FlowFunctions (heros.FlowFunctions)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1