Java Code Examples for soot.toolkits.graph.DirectedGraph#size()
The following examples show how to use
soot.toolkits.graph.DirectedGraph#size() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleVeryBusyExpressions.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public SimpleVeryBusyExpressions(DirectedGraph<Unit> graph) { SimpleVeryBusyAnalysis analysis = new SimpleVeryBusyAnalysis(graph); unitToExpressionsAfter = new HashMap<Unit, List<AbstractBinopExpr>>(graph.size() * 2 + 1, 0.7f); unitToExpressionsBefore = new HashMap<Unit, List<AbstractBinopExpr>>(graph.size() * 2 + 1, 0.7f); for (Unit s : graph) { FlowSet set = (FlowSet) analysis.getFlowBefore(s); unitToExpressionsBefore.put(s, Collections.unmodifiableList(set.toList())); set = (FlowSet) analysis.getFlowAfter(s); unitToExpressionsAfter.put(s, Collections.unmodifiableList(set.toList())); } }
Example 2
Source File: UnreachableCodeEliminator.java From JAADAS with GNU General Public License v3.0 | 6 votes |
private <T> Set<T> reachable(T first, DirectedGraph<T> g) { if ( first == null || g == null ) { return Collections.<T>emptySet(); } Set<T> visited = new HashSet<T>(g.size()); Deque<T> q = new ArrayDeque<T>(); q.addFirst(first); do { T t = q.removeFirst(); if ( visited.add(t) ) { q.addAll(g.getSuccsOf(t)); } } while (!q.isEmpty()); return visited; }
Example 3
Source File: AbstractFlowAnalysis.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** Constructs a flow analysis on the given <code>DirectedGraph</code>. */ public AbstractFlowAnalysis(DirectedGraph<N> graph) { unitToBeforeFlow = new IdentityHashMap<N,A>(graph.size() * 2 + 1); this.graph = graph; if (Options.v().interactive_mode()){ InteractionHandler.v().handleCfgEvent(graph); } }
Example 4
Source File: CFGToDotGraph.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** * Create a <code>DotGraph</code> whose nodes and edges depict * a control flow graph without distinguished * exceptional edges. * * @param graph a <code>DirectedGraph</code> representing a CFG * (probably an instance of {@link UnitGraph}, {@link BlockGraph}, * or one of their subclasses). * * @param body the <code>Body</code> represented by <code>graph</code> (used * to format the text within nodes). If no body is available, pass * <code>null</code>. * * @return a visualization of <code>graph</code>. */ public <N> DotGraph drawCFG(DirectedGraph<N> graph, Body body) { DotGraph canvas = initDotGraph(body); DotNamer<N> namer = new DotNamer<N>((int)(graph.size()/0.7f), 0.7f); NodeComparator<N> comparator = new NodeComparator<N>(namer); // To facilitate comparisons between different graphs of the same // method, prelabel the nodes in the order they appear // in the iterator, rather than the order that they appear in the // graph traversal (so that corresponding nodes are more likely // to have the same label in different graphs of a given method). for (Iterator<N> nodesIt = graph.iterator(); nodesIt.hasNext(); ) { namer.getName(nodesIt.next()); } for (Iterator<N> nodesIt = graph.iterator(); nodesIt.hasNext(); ) { N node = nodesIt.next(); canvas.drawNode(namer.getName(node)); for (Iterator<N> succsIt = sortedIterator(graph.getSuccsOf(node), comparator); succsIt.hasNext(); ) { N succ = succsIt.next(); canvas.drawEdge(namer.getName(node), namer.getName(succ)); } } setStyle(graph.getHeads(), canvas, namer, DotGraphConstants.NODE_STYLE_FILLED, headAttr); setStyle(graph.getTails(), canvas, namer, DotGraphConstants.NODE_STYLE_FILLED, tailAttr); if (! isBrief) { formatNodeText(body, canvas, namer); } return canvas; }
Example 5
Source File: ForwardFlowAnalysisExtended.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** * Construct the analysis from a DirectedGraph representation of a Body. */ public ForwardFlowAnalysisExtended(DirectedGraph<N> graph) { this.graph = graph; this.unitToBeforeFlow = new IdentityHashMap<N,Map<N, A>>(graph.size() * 2 + 1); this.unitToAfterFlow = new IdentityHashMap<N, Map<N, A>>(graph.size() * 2 + 1); }
Example 6
Source File: FlowAnalysis.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** Constructs a flow analysis on the given <code>DirectedGraph</code>. */ public FlowAnalysis(DirectedGraph<N> graph) { super(graph); unitToAfterFlow = new IdentityHashMap<N, A>(graph.size() * 2 + 1); }