Search in sources :

Example 26 with SegmentNode

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

the class IFigureManager method getSegmentNode.

/**
 * Generate a segment node from our own cache.
 * @return
 */
protected static SegmentNode getSegmentNode() {
    SegmentNode ret = null;
    if (segHeader != null) {
        ret = segHeader;
        segHeader = ret.next;
        ret.next = null;
        ret.is_new = true;
    } else
        ret = new SegmentNode();
    return ret;
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 27 with SegmentNode

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

the class HeapInsIntervalManager method flush.

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 28 with SegmentNode

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

the class HeapInsIntervalManager method clean_garbage_many_to_all.

// Clean garbages in the MANY_TO_ALL list that the information is already covered by mp
// BTW, we also do simple adjacent figures concatenation
private void clean_garbage_many_to_all(SegmentNode predator) {
    SegmentNode p, q, list;
    int num;
    long right, left;
    list = header[MANY_TO_ALL];
    p = q = null;
    num = 0;
    left = predator.I1;
    right = left + predator.L;
    while (list != null) {
        // We first process the overlapped cases
        if (list.I1 >= left) {
            if (list.I1 <= right) {
                if (list.I1 + list.L > right) {
                    // We extend predator to the right
                    right = list.I1 + list.L;
                }
                // else, this figure is completely contained in predator, we swallow it
                list = list.next;
                continue;
            }
        // else, this figure has no overlap with the predator
        } else if (list.I1 + list.L >= left) {
            // We extend predator to the left
            left = list.I1;
            list = list.next;
            continue;
        }
        // Because the newly inserted figures are headed at the list
        if (q == null) {
            p = q = list;
        } else {
            q.next = list;
            q = list;
        }
        ++num;
        list = list.next;
    }
    predator.I1 = left;
    predator.L = right - left;
    if (q != null)
        q.next = null;
    header[MANY_TO_ALL] = p;
    size[MANY_TO_ALL] = num;
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 29 with SegmentNode

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

the class HeapInsIntervalManager method clean_garbage_all_to_many.

// Clean the ALL_TO_MANY list
private void clean_garbage_all_to_many(SegmentNode predator) {
    SegmentNode p, q, list;
    int num;
    long right, left;
    list = header[ALL_TO_MANY];
    p = q = null;
    num = 0;
    left = predator.I2;
    right = predator.I2 + predator.L;
    while (list != null) {
        if (list.I2 >= left) {
            if (list.I2 <= right) {
                if (list.I2 + list.L > right) {
                    // We extend predator to the right
                    right = list.I2 + list.L;
                }
                list = list.next;
                continue;
            }
        } else if (list.I2 + list.L >= left) {
            // We extend predator to the left
            left = list.I2;
            list = list.next;
            continue;
        }
        // Because the unprocessed points-to tuples are headed at the list
        if (q == null) {
            p = q = list;
        } else {
            q.next = list;
            q = list;
        }
        ++num;
        list = list.next;
    }
    predator.I2 = left;
    predator.L = right - left;
    if (q != null)
        q.next = null;
    header[ALL_TO_MANY] = p;
    size[ALL_TO_MANY] = num;
}
Also used : SegmentNode(soot.jimple.spark.geom.dataRep.SegmentNode)

Example 30 with SegmentNode

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

the class HeapInsIntervalManager method clean_garbage_one_to_one.

/*
	 * Eliminate the redundant ONE_TO_ONE figures
	 */
private void clean_garbage_one_to_one(SegmentNode predator) {
    SegmentNode p, q, list;
    int num;
    list = header[ONE_TO_ONE];
    p = q = null;
    num = 0;
    while (list != null) {
        long L = list.L;
        if ((predator.I2 - predator.I1 == list.I2 - list.I1) && predator.I1 <= list.I1 && (predator.I1 + predator.L >= list.I2 + L))
            // So we ignore it
            ;
        else {
            if (q == null) {
                p = q = list;
            } else {
                q.next = list;
                q = list;
            }
            ++num;
        }
        list = list.next;
    }
    if (q != null)
        q.next = null;
    header[ONE_TO_ONE] = p;
    size[ONE_TO_ONE] = num;
}
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