protected Object keyFor(Stmt s) { if (s.containsInvokeExpr()) { if (optionNaive) { throw new RuntimeException("shouldn't get here"); } Iterator it = cg.edgesOutOf(s); if (!it.hasNext()) { return Collections.EMPTY_LIST; } ArrayList ret = new ArrayList(); while (it.hasNext()) { ret.add(it.next()); } return ret; } else { return s; } }
protected Object keyFor(Stmt s) { if (s.containsInvokeExpr()) { if (optionNaive) { throw new RuntimeException("shouldn't get here"); } Iterator it = cg.edgesOutOf(s); if (!it.hasNext()) { return Collections.EMPTY_LIST; } ArrayList ret = new ArrayList(); while (it.hasNext()) { ret.add(it.next()); } return ret; } else { return s; } }
public static int countCallEdgesForCallsite(Stmt callsite, boolean stopForMutiple) { CallGraph cg = Scene.v().getCallGraph(); int count = 0; for (Iterator<Edge> it = cg.edgesOutOf(callsite); it.hasNext();) { it.next(); ++count; if (stopForMutiple && count > 1) { break; } } return count; }
public Iterator<MethodOrMethodContext> iterator(MethodOrMethodContext momc) { ArrayList<MethodOrMethodContext> methods = new ArrayList<MethodOrMethodContext>(); Iterator<Edge> it = cg.edgesOutOf(momc); if (filter != null) { it = filter.wrap(it); } while (it.hasNext()) { Edge e = (Edge) it.next(); methods.add(e.getTgt()); } return iterator(methods.iterator()); }
public Iterator<MethodOrMethodContext> iterator(Unit u) { ArrayList<MethodOrMethodContext> methods = new ArrayList<MethodOrMethodContext>(); Iterator<Edge> it = cg.edgesOutOf(u); if (filter != null) { it = filter.wrap(it); } while (it.hasNext()) { Edge e = (Edge) it.next(); methods.add(e.getTgt()); } return iterator(methods.iterator()); }
private Iterator<MethodOrMethodContext> iterator(Set<MethodOrMethodContext> s, ArrayList<MethodOrMethodContext> worklist) { for (int i = 0; i < worklist.size(); i++) { MethodOrMethodContext method = worklist.get(i); Iterator<Edge> it = cg.edgesOutOf(method); if (filter != null) { it = filter.wrap(it); } while (it.hasNext()) { Edge e = (Edge) it.next(); if (s.add(e.getTgt())) { worklist.add(e.getTgt()); } } } return worklist.iterator(); } }
public List<SootMethod> find(Unit unit, CallGraph cg, boolean canBeNullList, boolean canBeNative) { List<SootMethod> target = new ArrayList<SootMethod>(); Iterator<Edge> it = cg.edgesOutOf(unit); while (it.hasNext()) { Edge edge = it.next(); SootMethod targetMethod = edge.tgt(); if (targetMethod.isNative() && !canBeNative) { continue; } if (edge.kind() == Kind.CLINIT) { continue; } target.add(targetMethod); } if (target.size() < 1 && !canBeNullList) { throw new RuntimeException("No target method for: " + unit); } return target; } }
private void dfsVisit(SootMethod m) { if (visited.contains(m)) { return; } visited.add(m); Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(m)); while (targets.hasNext()) { SootMethod target = (SootMethod) targets.next(); dfsVisit(target); } order.add(m); }
@Override public Collection<SootMethod> load(Unit u) throws Exception { ArrayList<SootMethod> res = null; // only retain callers that are explicit call sites or // Thread.start() Iterator<Edge> edgeIter = new EdgeFilter().wrap(cg.edgesOutOf(u)); while (edgeIter.hasNext()) { Edge edge = edgeIter.next(); SootMethod m = edge.getTgt().method(); if (includePhantomCallees || m.hasActiveBody()) { if (res == null) { res = new ArrayList<SootMethod>(); } res.add(m); } else if (IDESolver.DEBUG) { logger.error(String.format("Method %s is referenced but has no body!", m.getSignature(), new Exception())); } } if (res != null) { res.trimToSize(); return res; } else { return Collections.emptySet(); } } };
private void processNewMethodContext(MethodOrMethodContext momc) { SootMethod m = momc.method(); Iterator<Edge> it = cicg.edgesOutOf(m); while (it.hasNext()) { Edge e = it.next(); cm.addStaticEdge(momc, e.srcUnit(), e.tgt(), e.kind()); } }
copy(accum, dst); System.out.println("Edges out of " + callStmt + "..."); for (Iterator<Edge> it = cg.edgesOutOf(callStmt); it.hasNext();) { Edge edge = it.next(); SootMethod m = edge.tgt();
protected void flowThrough(Object inVal, Object stmt, Object outVal) { FlowSet in = (FlowSet) inVal; FlowSet out = (FlowSet) outVal; Stmt s = (Stmt) stmt; in.copy(out); CallGraph cg = Scene.v().getCallGraph(); Iterator edges = cg.edgesOutOf(s); while (edges.hasNext()) { Edge e = (Edge) edges.next(); if (e.isClinit()) { out.add(e.tgt()); } } }
Iterator edgesIt = callGraph.edgesOutOf(method); while (edgesIt.hasNext()) { SootMethod target = ((Edge) edgesIt.next()).tgt();
Iterator it = cg.edgesOutOf(stmt); TargetMethodsFinder tmd = new TargetMethodsFinder(); Iterator<SootMethod> targetIt = (tmd.find(stmt, cg, true, false)).iterator();
protected Object newInitialFlow() { ArraySparseSet set = new ArraySparseSet(); CallGraph cg = Scene.v().getCallGraph(); Iterator mIt = cg.edgesOutOf(g.getBody().getMethod()); while (mIt.hasNext()) { Edge edge = (Edge) mIt.next(); if (edge.isClinit()) { set.add(edge.tgt()); } } return set; } }
/** * Causes the QueueReader objects to be filled up with any methods that have become reachable since the last call. */ public void update() { while (edgeSource.hasNext()) { Edge e = edgeSource.next(); if (set.contains(e.getSrc())) { addMethod(e.getTgt()); } } while (unprocessedMethods.hasNext()) { MethodOrMethodContext m = unprocessedMethods.next(); Iterator<Edge> targets = cg.edgesOutOf(m); if (filter != null) { targets = filter.wrap(targets); } addMethods(new Targets(targets)); } }
while (sIt.hasNext()) { Stmt s = (Stmt) sIt.next(); Iterator edges = cg.edgesOutOf(s); while (edges.hasNext()) { Edge e = (Edge) edges.next();
Iterator edges = cg.edgesOutOf(s);
protected void internalTransform(Body b, String phaseName, Map options) { ClinitElimAnalysis a = new ClinitElimAnalysis(new BriefUnitGraph(b)); CallGraph cg = Scene.v().getCallGraph(); SootMethod m = b.getMethod(); Iterator edgeIt = cg.edgesOutOf(m); while (edgeIt.hasNext()) { Edge e = (Edge) edgeIt.next(); if (e.srcStmt() == null) { continue; } if (!e.isClinit()) { continue; } FlowSet methods = (FlowSet) a.getFlowBefore(e.srcStmt()); if (methods.contains(e.tgt())) { cg.removeEdge(e); } } } }
String subSig = methodRef.resolve().getSubSignature(); CallGraph cg = Scene.v().getCallGraph(); for (Iterator<Edge> edges = cg.edgesOutOf(is); edges.hasNext();) { Edge e = edges.next(); SootMethod target = e.getTgt().method();