Search in sources :

Example 41 with SegmentNode

use of soot.jimple.spark.geom.dataRep.SegmentNode 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)

Example 42 with SegmentNode

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

the class FullSensitiveNode method print_context_sensitive_points_to.

@Override
public void print_context_sensitive_points_to(PrintStream outPrintStream) {
    for (Iterator<AllocNode> it = pt_objs.keySet().iterator(); it.hasNext(); ) {
        AllocNode obj = it.next();
        SegmentNode[] int_entry = find_points_to(obj);
        for (int j = 0; j < GeometricManager.Divisions; ++j) {
            SegmentNode p = int_entry[j];
            while (p != null) {
                outPrintStream.print("(" + obj.toString() + ", " + p.I1 + ", " + p.I2 + ", " + p.L + ", ");
                if (p instanceof RectangleNode)
                    outPrintStream.print(((RectangleNode) p).L_prime + ", ");
                outPrintStream.println(symbols[j] + ")");
                p = p.next;
            }
        }
    }
}
Also used : AllocNode(soot.jimple.spark.pag.AllocNode) RectangleNode(soot.jimple.spark.geom.dataRep.RectangleNode) PlainConstraint(soot.jimple.spark.geom.dataRep.PlainConstraint) SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 43 with SegmentNode

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

the class FullSensitiveNode method addPointsTo.

// -----------------------------------Private Functions---------------------------------------
/**
 * A non-interface public function.
 * It adds the points-to tuple to the geometric manager.
 */
private boolean addPointsTo(int code, AllocNode obj) {
    GeometricManager gm = pt_objs.get(obj);
    if (gm == null) {
        gm = new GeometricManager();
        pt_objs.put(obj, gm);
    } else if (gm == deadManager) {
        // We preclude the propagation of this object
        return false;
    }
    SegmentNode p = gm.addNewFigure(code, pres);
    if (p != null) {
        new_pts.put(obj, gm);
        return true;
    }
    return false;
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 44 with SegmentNode

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

the class GeometricManager method flush.

/**
 * Remove the new labels for all the figures.
 */
public void flush() {
    hasNewFigure = false;
    for (int i = 0; i < Divisions; ++i) {
        SegmentNode p = header[i];
        while (p != null && p.is_new == true) {
            p.is_new = false;
            p = p.next;
        }
    }
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 45 with SegmentNode

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

the class IFigureManager method reclaimSegmentNode.

/**
 * Return the segment node to cache.
 * @param p
 * @return
 */
protected static SegmentNode reclaimSegmentNode(SegmentNode p) {
    SegmentNode q = p.next;
    p.next = segHeader;
    segHeader = p;
    return q;
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Aggregations

SegmentNode (soot.jimple.spark.geom.dataRep.SegmentNode)51 PlainConstraint (soot.jimple.spark.geom.dataRep.PlainConstraint)24 AllocNode (soot.jimple.spark.pag.AllocNode)12 HashMap (java.util.HashMap)6 Map (java.util.Map)6 RectangleNode (soot.jimple.spark.geom.dataRep.RectangleNode)5 SootMethod (soot.SootMethod)3 GeomPointsTo (soot.jimple.spark.geom.geomPA.GeomPointsTo)3 StringConstantNode (soot.jimple.spark.pag.StringConstantNode)3 ClassConstantNode (soot.jimple.spark.pag.ClassConstantNode)2