Search in sources :

Example 6 with GeomPointsTo

use of soot.jimple.spark.geom.geomPA.GeomPointsTo in project soot by Sable.

the class PtInsNode method injectPts.

@Override
public void injectPts() {
    final GeomPointsTo geomPTA = (GeomPointsTo) Scene.v().getPointsToAnalysis();
    pt_objs = new HashMap<AllocNode, PtInsIntervalManager>();
    me.getP2Set().forall(new P2SetVisitor() {

        @Override
        public void visit(Node n) {
            if (geomPTA.isValidGeometricNode(n))
                pt_objs.put((AllocNode) n, (PtInsIntervalManager) stubManager);
        }
    });
    new_pts = null;
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) GeomPointsTo(soot.jimple.spark.geom.geomPA.GeomPointsTo) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Node(soot.jimple.spark.pag.Node) AllocNode(soot.jimple.spark.pag.AllocNode) P2SetVisitor(soot.jimple.spark.sets.P2SetVisitor)

Example 7 with GeomPointsTo

use of soot.jimple.spark.geom.geomPA.GeomPointsTo in project soot by Sable.

the class FullSensitiveNode method injectPts.

/**
 *  We transfer the SPARK results to current pointer if this pointer is not involved in the geometric analysis.
 *  Note that, the unreachable objects will not be inserted.
 */
@Override
public void injectPts() {
    final GeomPointsTo geomPTA = (GeomPointsTo) Scene.v().getPointsToAnalysis();
    pt_objs = new HashMap<AllocNode, GeometricManager>();
    me.getP2Set().forall(new P2SetVisitor() {

        @Override
        public void visit(Node n) {
            if (geomPTA.isValidGeometricNode(n))
                pt_objs.put((AllocNode) n, (GeometricManager) stubManager);
        }
    });
    new_pts = null;
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) GeomPointsTo(soot.jimple.spark.geom.geomPA.GeomPointsTo) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Node(soot.jimple.spark.pag.Node) AllocNode(soot.jimple.spark.pag.AllocNode) P2SetVisitor(soot.jimple.spark.sets.P2SetVisitor)

Example 8 with GeomPointsTo

use of soot.jimple.spark.geom.geomPA.GeomPointsTo in project soot by Sable.

the class FullSensitiveNode method get_all_context_sensitive_objects.

@Override
public void get_all_context_sensitive_objects(long l, long r, PtSensVisitor visitor) {
    if (parent != this) {
        getRepresentative().get_all_context_sensitive_objects(l, r, visitor);
        return;
    }
    GeomPointsTo geomPTA = (GeomPointsTo) Scene.v().getPointsToAnalysis();
    for (Map.Entry<AllocNode, GeometricManager> entry : pt_objs.entrySet()) {
        AllocNode obj = entry.getKey();
        SootMethod sm = obj.getMethod();
        int sm_int = geomPTA.getIDFromSootMethod(sm);
        if (sm_int == -1)
            continue;
        GeometricManager gm = entry.getValue();
        SegmentNode[] int_entry = gm.getFigures();
        for (int i = 0; i < GeometricManager.Divisions; ++i) {
            // We iterate all the figures
            SegmentNode p = int_entry[i];
            while (p != null) {
                long L = p.I1;
                long R = L + p.L;
                long objL = -1, objR = -1;
                // Now we compute which context sensitive objects are pointed to by this pointer
                if (l <= L && L < r) {
                    // L------------R
                    if (i == GeometricManager.ONE_TO_ONE) {
                        long d = r - L;
                        if (R < r)
                            d = p.L;
                        objL = p.I2;
                        objR = objL + d;
                    } else {
                        objL = p.I2;
                        objR = p.I2 + ((RectangleNode) p).L_prime;
                    }
                } else if (L <= l && l < R) {
                    // L--------------------R
                    if (i == GeometricManager.ONE_TO_ONE) {
                        long d = R - l;
                        if (R > r)
                            d = r - l;
                        objL = p.I2 + l - L;
                        objR = objL + d;
                    } else {
                        objL = p.I2;
                        objR = p.I2 + ((RectangleNode) p).L_prime;
                    }
                }
                // Now we test which context versions this interval [objL, objR) maps to
                if (objL != -1 && objR != -1)
                    visitor.visit(obj, objL, objR, sm_int);
                p = p.next;
            }
        }
    }
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode) GeomPointsTo(soot.jimple.spark.geom.geomPA.GeomPointsTo) SootMethod(soot.SootMethod) HashMap(java.util.HashMap) Map(java.util.Map) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Aggregations

GeomPointsTo (soot.jimple.spark.geom.geomPA.GeomPointsTo)8 SegmentNode (soot.jimple.spark.geom.dataRep.SegmentNode)6 AllocNode (soot.jimple.spark.pag.AllocNode)6 RectangleNode (soot.jimple.spark.geom.dataRep.RectangleNode)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 SootMethod (soot.SootMethod)3 PlainConstraint (soot.jimple.spark.geom.dataRep.PlainConstraint)3 LocalVarNode (soot.jimple.spark.pag.LocalVarNode)3 Node (soot.jimple.spark.pag.Node)3 StringConstantNode (soot.jimple.spark.pag.StringConstantNode)3 P2SetVisitor (soot.jimple.spark.sets.P2SetVisitor)3 ClassConstantNode (soot.jimple.spark.pag.ClassConstantNode)2 PAG (soot.jimple.spark.pag.PAG)2 CallGraphBuilder (soot.jimple.toolkits.callgraph.CallGraphBuilder)2 Date (java.util.Date)1 PointsToAnalysis (soot.PointsToAnalysis)1 ReachingTypeDumper (soot.jimple.ReachingTypeDumper)1 ContextInsensitiveBuilder (soot.jimple.spark.builder.ContextInsensitiveBuilder)1 SparkNativeHelper (soot.jimple.spark.internal.SparkNativeHelper)1