Search in sources :

Example 1 with IntervalContextVar

use of soot.jimple.spark.geom.dataRep.IntervalContextVar in project soot by Sable.

the class GeomQueries method contextsGoBy.

/**
 * Searching the points-to results for field expression such as p.f.
 *
 * @param sootEdge
 * @param l
 * @param field
 * @param visitor
 * @return
 */
@SuppressWarnings("rawtypes")
public boolean contextsGoBy(Edge sootEdge, Local l, SparkField field, PtSensVisitor visitor) {
    Obj_full_extractor pts_l = new Obj_full_extractor();
    if (contextsGoBy(sootEdge, l, pts_l) == false)
        return false;
    visitor.prepare();
    for (IntervalContextVar icv : pts_l.outList) {
        AllocNode obj = (AllocNode) icv.var;
        AllocDotField obj_f = geomPTA.findAllocDotField(obj, field);
        if (obj_f == null)
            continue;
        IVarAbstraction objField = geomPTA.findInternalNode(obj_f);
        if (objField == null)
            continue;
        long L = icv.L;
        long R = icv.R;
        assert L < R;
        objField.get_all_context_sensitive_objects(L, R, visitor);
    }
    pts_l = null;
    visitor.finish();
    return visitor.numOfDiffObjects() != 0;
}
Also used : AllocDotField(soot.jimple.spark.pag.AllocDotField) AllocNode(soot.jimple.spark.pag.AllocNode) Obj_full_extractor(soot.jimple.spark.geom.dataMgr.Obj_full_extractor) IntervalContextVar(soot.jimple.spark.geom.dataRep.IntervalContextVar)

Example 2 with IntervalContextVar

use of soot.jimple.spark.geom.dataRep.IntervalContextVar in project soot by Sable.

the class GeomQueries method kCFA.

/**
 * Standard K-CFA querying for field expression.
 *
 * @param callEdgeChain: callEdgeChain[0] is the farthest call edge in the chain.
 * @param l
 * @param field
 * @param visitor
 * @return
 */
@SuppressWarnings("rawtypes")
public boolean kCFA(Edge[] callEdgeChain, Local l, SparkField field, PtSensVisitor visitor) {
    // We first obtain the points-to information for l
    Obj_full_extractor pts_l = new Obj_full_extractor();
    if (kCFA(callEdgeChain, l, pts_l) == false)
        return false;
    // We compute the points-to information for l.field
    visitor.prepare();
    for (IntervalContextVar icv : pts_l.outList) {
        AllocNode obj = (AllocNode) icv.var;
        AllocDotField obj_f = geomPTA.findAllocDotField(obj, field);
        if (obj_f == null)
            continue;
        IVarAbstraction objField = geomPTA.findInternalNode(obj_f);
        if (objField == null)
            continue;
        long L = icv.L;
        long R = icv.R;
        assert L < R;
        objField.get_all_context_sensitive_objects(L, R, visitor);
    }
    pts_l = null;
    visitor.finish();
    return visitor.numOfDiffObjects() != 0;
}
Also used : AllocDotField(soot.jimple.spark.pag.AllocDotField) AllocNode(soot.jimple.spark.pag.AllocNode) Obj_full_extractor(soot.jimple.spark.geom.dataMgr.Obj_full_extractor) IntervalContextVar(soot.jimple.spark.geom.dataRep.IntervalContextVar)

Example 3 with IntervalContextVar

use of soot.jimple.spark.geom.dataRep.IntervalContextVar in project soot by Sable.

the class Obj_full_extractor method visit.

@Override
public boolean visit(Node var, long L, long R, int sm_int) {
    if (readyToUse)
        return false;
    List<IntervalContextVar> resList = tableView.get(var);
    if (resList == null) {
        // The first time this object is inserted
        resList = new ArrayList<IntervalContextVar>();
    } else {
        // We search the list and merge the context sensitive objects
        backupList.clear();
        tmp_icv.L = L;
        tmp_icv.R = R;
        for (IntervalContextVar old_cv : resList) {
            if (old_cv.contains(tmp_icv)) {
                /*
					 * Becase we keep the intervals disjoint.
					 * It's impossible the passed in interval is contained in an interval or intersects with other intervals.
					 * In such case, we can directly return.
					 */
                return false;
            }
            if (!tmp_icv.merge(old_cv))
                backupList.add(old_cv);
        }
        // We switch the backup list with the original list
        List<IntervalContextVar> tmpList = backupList;
        backupList = resList;
        resList = tmpList;
        // Write back
        L = tmp_icv.L;
        R = tmp_icv.R;
    }
    IntervalContextVar icv = new IntervalContextVar(L, R, var);
    resList.add(icv);
    tableView.put(var, resList);
    return true;
}
Also used : IntervalContextVar(soot.jimple.spark.geom.dataRep.IntervalContextVar)

Aggregations

IntervalContextVar (soot.jimple.spark.geom.dataRep.IntervalContextVar)3 Obj_full_extractor (soot.jimple.spark.geom.dataMgr.Obj_full_extractor)2 AllocDotField (soot.jimple.spark.pag.AllocDotField)2 AllocNode (soot.jimple.spark.pag.AllocNode)2