use of soot.jimple.spark.geom.dataRep.SegmentNode in project soot by Sable.
the class HeapInsNode method count_new_pts_intervals.
@Override
public int count_new_pts_intervals() {
int ans = 0;
for (HeapInsIntervalManager im : new_pts.values()) {
SegmentNode[] int_entry = im.getFigures();
for (int i = 0; i < HeapInsIntervalManager.Divisions; ++i) {
SegmentNode p = int_entry[i];
while (p != null && p.is_new == true) {
++ans;
p = p.next;
}
}
}
return ans;
}
use of soot.jimple.spark.geom.dataRep.SegmentNode in project soot by Sable.
the class HeapInsNode 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, HeapInsIntervalManager> entry : pt_objs.entrySet()) {
AllocNode obj = entry.getKey();
HeapInsIntervalManager im = entry.getValue();
SegmentNode[] int_entry = im.getFigures();
// We first get the 1-CFA contexts for the object
SootMethod sm = obj.getMethod();
int sm_int = 0;
long n_contexts = 1;
if (sm != null) {
sm_int = geomPTA.getIDFromSootMethod(sm);
n_contexts = geomPTA.context_size[sm_int];
}
// We search for all the pointers falling in the range [1, r) that may point to this object
for (int i = 0; i < HeapInsIntervalManager.Divisions; ++i) {
SegmentNode p = int_entry[i];
while (p != null) {
long R = p.I1 + p.L;
long objL = -1, objR = -1;
// Now we compute which context sensitive objects are pointed to by this pointer
if (i == HeapInsIntervalManager.ALL_TO_MANY) {
// all-to-many figures
objL = p.I2;
objR = p.I2 + p.L;
} else {
// We compute the intersection
if (l <= p.I1 && p.I1 < r) {
if (i != HeapInsIntervalManager.MANY_TO_ALL) {
long d = r - p.I1;
if (d > p.L)
d = p.L;
objL = p.I2;
objR = objL + d;
} else {
objL = 1;
objR = 1 + n_contexts;
}
} else if (p.I1 <= l && l < R) {
if (i != HeapInsIntervalManager.MANY_TO_ALL) {
long d = R - l;
if (R > r)
d = r - l;
objL = p.I2 + l - p.I1;
objR = objL + d;
} else {
objL = 1;
objR = 1 + n_contexts;
}
}
}
// Now we test which context versions should this interval [objL, objR) maps to
if (objL != -1 && objR != -1)
visitor.visit(obj, objL, objR, sm_int);
p = p.next;
}
}
}
}
use of soot.jimple.spark.geom.dataRep.SegmentNode in project soot by Sable.
the class HeapInsNode 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 < HeapInsIntervalManager.Divisions; ++j) {
SegmentNode p = int_entry[j];
while (p != null) {
outPrintStream.println("(" + obj.toString() + ", " + p.I1 + ", " + p.I2 + ", " + p.L + ")");
p = p.next;
}
}
}
}
use of soot.jimple.spark.geom.dataRep.SegmentNode in project soot by Sable.
the class HeapInsNode method pointer_interval_points_to.
@Override
public boolean pointer_interval_points_to(long l, long r, AllocNode obj) {
SegmentNode[] int_entry = find_points_to(obj);
if (int_entry == null)
return false;
// Check all-to-many figures
if (int_entry[HeapInsIntervalManager.ALL_TO_MANY] != null)
return true;
for (int i = 1; i < HeapInsIntervalManager.Divisions; ++i) {
SegmentNode p = int_entry[i];
while (p != null) {
long R = p.I1 + p.L;
if ((l <= p.I1 && p.I1 < r) || (p.I1 <= l && l < R))
return true;
p = p.next;
}
}
return false;
}
use of soot.jimple.spark.geom.dataRep.SegmentNode in project soot by Sable.
the class PtInsIntervalManager method generate_many_to_all.
/**
* The result is in the form: (p, q, I, 0, L)
*/
private SegmentNode generate_many_to_all(SegmentNode mp) {
long left, right, t;
SegmentNode p;
left = mp.I1;
right = left + mp.L;
p = mp.next;
while (p != null) {
if (p.I1 < left)
left = p.I1;
t = p.I1 + p.L;
if (t > right)
right = t;
p = p.next;
}
// Note, left could be 0. In that case, the propagation along this edge becomes totally insensitive
mp.I1 = left;
mp.I2 = 0;
mp.L = right - left;
mp.next = null;
return mp;
}
Aggregations