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()); }
public Iterator<Edge> wrap(Iterator<Edge> source) { this.source = source; advance(); return this; }
public DeadlockDetector(boolean optionPrintDebug, boolean optionRepairDeadlock, boolean optionAllowSelfEdges, List<CriticalSection> criticalSections) { this.optionPrintDebug = optionPrintDebug; this.optionRepairDeadlock = optionRepairDeadlock; this.optionAllowSelfEdges = optionAllowSelfEdges && !optionRepairDeadlock; // can only do this if not repairing this.criticalSections = criticalSections; this.tt = new TransitiveTargets(Scene.v().getCallGraph(), new Filter(new CriticalSectionVisibleEdgesPred(null))); }
protected void internalTransform(String phaseName, Map options) { Filter explicitInvokesFilter = new Filter(new ExplicitEdgesPred()); if (Options.v().verbose()) { logger.debug("[] Inlining methods..."); if (!explicitInvokesFilter.wrap(cg.edgesOutOf(container)).hasNext()) { continue; Iterator targets = new Targets(explicitInvokesFilter.wrap(cg.edgesOutOf(s))); if (!targets.hasNext()) { continue;
protected void internalTransform(String phaseName, Map opts) { Filter instanceInvokesFilter = new Filter(new InstanceInvokeEdgesPred()); SMBOptions options = new SMBOptions(opts); String modifierOptions = PhaseOptions.getString(opts, "allowed-modifier-changes"); if (!instanceInvokesFilter.wrap(cg.edgesOutOf(container)).hasNext()) { continue; Iterator targets = new Targets(instanceInvokesFilter.wrap(cg.edgesOutOf(s))); if (!targets.hasNext()) { continue;
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 Edge next() { Edge ret = next; advance(); return ret; }
this.cg = cg; this.tve = new CriticalSectionVisibleEdgesPred(criticalSections); this.tt = new TransitiveTargets(cg, new Filter(tve)); this.normaltt = new TransitiveTargets(cg, null); this.normalsea = new SideEffectAnalysis(pa, cg);
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 Iterator<Edge> wrap( Iterator<Edge> source ) { this.source = source; advance(); return this; } private void advance() {
TransitiveTargets runMethodTargets = new TransitiveTargets(callGraph, new Filter(new RunMethodsPred()));
public ReachableMethods(CallGraph graph, Iterator<? extends MethodOrMethodContext> entryPoints, Filter filter) { this.filter = filter; this.cg = graph; addMethods(entryPoints); unprocessedMethods = reachables.reader(); this.edgeSource = graph.listener(); if (filter != null) { this.edgeSource = filter.wrap(this.edgeSource); } }
public Edge next() { Edge ret = next; advance(); return ret; } public void remove() {
/** * 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)); } }
public Iterator<Edge> wrap( Iterator<Edge> source ) { this.source = source; advance(); return this; } private void advance() {
public Iterator<MethodOrMethodContext> iterator( MethodOrMethodContext momc ) { ArrayList<MethodOrMethodContext> methods = new ArrayList<MethodOrMethodContext>(); Iterator 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( Iterator<MethodOrMethodContext> methods ) {
public Edge next() { Edge ret = next; advance(); return ret; } public void remove() {
public Iterator<MethodOrMethodContext> iterator( MethodOrMethodContext momc ) { ArrayList<MethodOrMethodContext> methods = new ArrayList<MethodOrMethodContext>(); Iterator 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( Iterator<MethodOrMethodContext> methods ) {
private Iterator<MethodOrMethodContext> iterator( Set<MethodOrMethodContext> s, ArrayList<MethodOrMethodContext> worklist ) { for( int i = 0; i < worklist.size(); i++ ) { MethodOrMethodContext method = worklist.get(i); Iterator 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(); } }