Search in sources :

Example 1 with ContextVarNode

use of soot.jimple.spark.pag.ContextVarNode in project soot by Sable.

the class GeomPointsTo method reachingObjects.

/*
	 * Currently, we only accept one call unit context (1CFA).
	 * For querying K-CFA (K >1), please see GeomQueries.contextsByCallChain
	 */
@Override
public PointsToSet reachingObjects(Context c, Local l) {
    if (!hasExecuted)
        return super.reachingObjects(c, l);
    if (hasTransformed || !(c instanceof Unit))
        return reachingObjects(l);
    LocalVarNode vn = findLocalVarNode(l);
    if (vn == null)
        return EmptyPointsToSet.v();
    // Lookup the context sensitive points-to information for this pointer
    IVarAbstraction pn = consG.get(vn);
    if (pn == null)
        return vn.getP2Set();
    pn = pn.getRepresentative();
    // Obtain the context sensitive points-to result
    SootMethod callee = vn.getMethod();
    Edge e = Scene.v().getCallGraph().findEdge((Unit) c, callee);
    if (e == null)
        return vn.getP2Set();
    // Compute the contexts interval
    CgEdge myEdge = getInternalEdgeFromSootEdge(e);
    if (myEdge == null)
        return vn.getP2Set();
    long low = myEdge.map_offset;
    long high = low + max_context_size_block[myEdge.s];
    // Lookup the cache
    ContextVarNode cvn = vn.context(c);
    if (cvn != null) {
        PointsToSetInternal ans = cvn.getP2Set();
        if (ans != EmptyPointsToSet.v())
            return ans;
    } else {
        // Create a new context sensitive variable
        // The points-to vector is set to empty at start
        cvn = makeContextVarNode(vn, c);
    }
    // Fill
    PointsToSetInternal ptset = cvn.makeP2Set();
    for (AllocNode an : pn.get_all_points_to_objects()) {
        if (pn.pointer_interval_points_to(low, high, an))
            ptset.add(an);
    }
    return ptset;
}
Also used : CgEdge(soot.jimple.spark.geom.dataRep.CgEdge) AllocNode(soot.jimple.spark.pag.AllocNode) PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) SootMethod(soot.SootMethod) ContextVarNode(soot.jimple.spark.pag.ContextVarNode) Unit(soot.Unit) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Edge(soot.jimple.toolkits.callgraph.Edge) CgEdge(soot.jimple.spark.geom.dataRep.CgEdge)

Aggregations

SootMethod (soot.SootMethod)1 Unit (soot.Unit)1 CgEdge (soot.jimple.spark.geom.dataRep.CgEdge)1 AllocNode (soot.jimple.spark.pag.AllocNode)1 ContextVarNode (soot.jimple.spark.pag.ContextVarNode)1 LocalVarNode (soot.jimple.spark.pag.LocalVarNode)1 PointsToSetInternal (soot.jimple.spark.sets.PointsToSetInternal)1 Edge (soot.jimple.toolkits.callgraph.Edge)1