Search in sources :

Example 31 with VarNode

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

the class PropIter method handleStores.

protected final boolean handleStores(VarNode src) {
    boolean ret = false;
    final PointsToSetInternal srcSet = src.getP2Set();
    if (srcSet.isEmpty())
        return false;
    Node[] storeTargets = pag.storeLookup(src);
    for (Node element : storeTargets) {
        final FieldRefNode fr = (FieldRefNode) element;
        final SparkField f = fr.getField();
        ret = fr.getBase().getP2Set().forall(new P2SetVisitor() {

            public final void visit(Node n) {
                AllocDotField nDotF = pag.makeAllocDotField((AllocNode) n, f);
                if (nDotF.makeP2Set().addAll(srcSet, null)) {
                    returnValue = true;
                }
            }
        }) | ret;
    }
    return ret;
}
Also used : FieldRefNode(soot.jimple.spark.pag.FieldRefNode) AllocDotField(soot.jimple.spark.pag.AllocDotField) AllocNode(soot.jimple.spark.pag.AllocNode) PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) NewInstanceNode(soot.jimple.spark.pag.NewInstanceNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) SparkField(soot.jimple.spark.pag.SparkField) P2SetVisitor(soot.jimple.spark.sets.P2SetVisitor)

Example 32 with VarNode

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

the class PropIter method handleLoads.

protected final boolean handleLoads(FieldRefNode src) {
    boolean ret = false;
    final Node[] loadTargets = pag.loadLookup(src);
    final SparkField f = src.getField();
    ret = src.getBase().getP2Set().forall(new P2SetVisitor() {

        public final void visit(Node n) {
            AllocDotField nDotF = ((AllocNode) n).dot(f);
            if (nDotF == null)
                return;
            PointsToSetInternal set = nDotF.getP2Set();
            if (set.isEmpty())
                return;
            for (Node element : loadTargets) {
                VarNode target = (VarNode) element;
                if (target.makeP2Set().addAll(set, null)) {
                    returnValue = true;
                }
            }
        }
    }) | ret;
    return ret;
}
Also used : VarNode(soot.jimple.spark.pag.VarNode) AllocDotField(soot.jimple.spark.pag.AllocDotField) PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) NewInstanceNode(soot.jimple.spark.pag.NewInstanceNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) SparkField(soot.jimple.spark.pag.SparkField) P2SetVisitor(soot.jimple.spark.sets.P2SetVisitor)

Example 33 with VarNode

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

the class PropWorklist method handleAllocNode.

/* End of public methods. */
/* End of package methods. */
/**
 * Propagates new points-to information of node src to all its successors.
 */
protected final boolean handleAllocNode(AllocNode src) {
    boolean ret = false;
    Node[] targets = pag.allocLookup(src);
    for (Node element : targets) {
        if (element.makeP2Set().add(src)) {
            varNodeWorkList.add((VarNode) element);
            ret = true;
        }
    }
    return ret;
}
Also used : ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) NewInstanceNode(soot.jimple.spark.pag.NewInstanceNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode)

Example 34 with VarNode

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

the class MergeChecker method handleStores.

protected void handleStores(final VarNode src) {
    final PointsToSetInternal srcSet = src.getP2Set();
    if (srcSet.isEmpty())
        return;
    Node[] storeTargets = pag.storeLookup(src);
    for (Node element : storeTargets) {
        final FieldRefNode fr = (FieldRefNode) element;
        checkAll(fr, srcSet, src);
    }
}
Also used : FieldRefNode(soot.jimple.spark.pag.FieldRefNode) PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode)

Example 35 with VarNode

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

the class OfflineProcessor method defaultFeedPtsRoutines.

public void defaultFeedPtsRoutines() {
    switch(Parameters.seedPts) {
        case Constants.seedPts_allUser:
            setAllUserCodeVariablesUseful();
            break;
        case Constants.seedPts_all:
            // All pointers will be processed
            for (int i = 0; i < n_var; ++i) {
                IVarAbstraction pn = int2var.get(i);
                if (pn != null && pn.getRepresentative() == pn)
                    pn.willUpdate = true;
            }
            return;
    }
    // We always refine the callsites that have multiple call targets
    Set<Node> multiBaseptrs = new HashSet<Node>();
    for (Stmt callsite : geomPTA.multiCallsites) {
        InstanceInvokeExpr iie = (InstanceInvokeExpr) callsite.getInvokeExpr();
        VarNode vn = geomPTA.findLocalVarNode(iie.getBase());
        multiBaseptrs.add(vn);
    }
    addUserDefPts(multiBaseptrs);
}
Also used : GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) VarNode(soot.jimple.spark.pag.VarNode) GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) InstanceInvokeExpr(soot.jimple.InstanceInvokeExpr) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) HashSet(java.util.HashSet) Stmt(soot.jimple.Stmt) AssignStmt(soot.jimple.AssignStmt)

Aggregations

VarNode (soot.jimple.spark.pag.VarNode)47 AllocNode (soot.jimple.spark.pag.AllocNode)37 Node (soot.jimple.spark.pag.Node)29 FieldRefNode (soot.jimple.spark.pag.FieldRefNode)24 LocalVarNode (soot.jimple.spark.pag.LocalVarNode)23 PointsToSetInternal (soot.jimple.spark.sets.PointsToSetInternal)22 GlobalVarNode (soot.jimple.spark.pag.GlobalVarNode)17 SparkField (soot.jimple.spark.pag.SparkField)15 HashSet (java.util.HashSet)11 NewInstanceNode (soot.jimple.spark.pag.NewInstanceNode)11 SootMethod (soot.SootMethod)10 ClassConstantNode (soot.jimple.spark.pag.ClassConstantNode)10 RefType (soot.RefType)8 Type (soot.Type)8 P2SetVisitor (soot.jimple.spark.sets.P2SetVisitor)8 AssignEdge (soot.jimple.spark.ondemand.pautil.AssignEdge)7 Iterator (java.util.Iterator)6 ImmutableStack (soot.jimple.spark.ondemand.genericutil.ImmutableStack)6 Stack (soot.jimple.spark.ondemand.genericutil.Stack)6 AllocDotField (soot.jimple.spark.pag.AllocDotField)6