use of soot.jimple.spark.pag.FieldRefNode in project soot by Sable.
the class SootUtil method buildStoreMap.
public static FieldAccessMap buildStoreMap(PAG pag) {
FieldAccessMap ret = new FieldAccessMap();
Iterator frNodeIter = pag.storeInvSourcesIterator();
while (frNodeIter.hasNext()) {
FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
SparkField field = frNode.getField();
Node[] targets = pag.storeInvLookup(frNode);
for (int i = 0; i < targets.length; i++) {
VarNode target = (VarNode) targets[i];
if (target instanceof GlobalVarNode)
continue;
ret.put(field, new Pair<FieldRefNode, LocalVarNode>(frNode, (LocalVarNode) target));
}
}
return ret;
}
use of soot.jimple.spark.pag.FieldRefNode in project soot by Sable.
the class SootUtil method loadsOnField.
public static FieldToEdgesMap loadsOnField(PAG pag) {
FieldToEdgesMap loadsOnField = new FieldToEdgesMap();
Iterator frNodeIter = pag.loadSourcesIterator();
while (frNodeIter.hasNext()) {
FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
VarNode source = frNode.getBase();
SparkField field = frNode.getField();
Node[] targets = pag.loadLookup(frNode);
for (int i = 0; i < targets.length; i++) {
VarNode target = (VarNode) targets[i];
loadsOnField.put(field, new Pair<VarNode, VarNode>(target, source));
}
}
return loadsOnField;
}
use of soot.jimple.spark.pag.FieldRefNode 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;
}
use of soot.jimple.spark.pag.FieldRefNode 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;
}
use of soot.jimple.spark.pag.FieldRefNode in project soot by Sable.
the class PropWorklist method handleFieldRefNode.
/**
* Propagates new points-to information of node src to all its successors.
*/
protected final void handleFieldRefNode(FieldRefNode src, final HashSet<Object[]> edgesToPropagate) {
final Node[] loadTargets = pag.loadLookup(src);
if (loadTargets.length == 0)
return;
final SparkField field = src.getField();
src.getBase().getP2Set().forall(new P2SetVisitor() {
public final void visit(Node n) {
AllocDotField nDotF = pag.makeAllocDotField((AllocNode) n, field);
if (nDotF != null) {
PointsToSetInternal p2Set = nDotF.getP2Set();
if (!p2Set.getNewSet().isEmpty()) {
for (Node element : loadTargets) {
Object[] pair = { p2Set, element };
edgesToPropagate.add(pair);
}
}
}
}
});
}
Aggregations