/** * Return the set of edge labels for the control flow edges that cause the given edge in the CDG. Requires that the CDG be * constructed with wantEdgeLabels being true. */ public Set<? extends Object> getEdgeLabels(T from, T to) { return edgeLabels.get(Pair.make(from, to)); }
/** * Return the set of edge labels for the control flow edges that cause the given edge in the CDG. Requires that the CDG be * constructed with wantEdgeLabels being true. */ public Set<? extends Object> getEdgeLabels(T from, T to) { return edgeLabels.get(Pair.make(from, to)); }
public V getEdge(Object src, Object dst) { assert src != null; assert dst != null; V v = getEdge(Pair.make(src, dst)); assert v != null; return v; }
/** * record a delayed edge addition from src to dst. Edge will be added when * appropriate; see {@link #checkForRealizedEdges(CAstNode)} and * {@link #checkForRealizedExitEdges(PreBasicBlock)} */ private void addDelayedEdge(PreBasicBlock src, Object dst, boolean exception) { MapUtil.findOrCreateSet(delayedEdges, dst).add(Pair.make(src, exception)); }
public VarVertex makeVarVertex(FuncVertex func, int valueNumber) { Pair<FuncVertex, Integer> key = Pair.make(func, valueNumber); VarVertex value = varVertexCache.get(key); if(value == null) varVertexCache.put(key, value = new VarVertex(func, valueNumber)); return value; }
public V getEdge(Object src, Object dst) { assert src != null; assert dst != null; V v = getEdge(Pair.make(src, dst)); assert v != null; return v; }
@Override protected Iterator<? extends T> getPendingChildren(T n) { Pair<List<T>,T> key = Pair.make(currentPath(), n); return pendingChildren.get(key); }
private IMethod makeObjectCall(IClass cls, int nargs) { assert nargs == 0; Object key = Pair.make(cls, Integer.valueOf(nargs)); if (constructors.containsKey(key)) return constructors.get(key); else return record(key, makeNullaryObjectConstructor(cls)); }
@Override public void addSeed(PathEdge<T> seed) { if (getSeeds().contains(seed)) { return; } unbalancedSeeds.add(Pair.make(seed.entry, seed.d1)); super.addSeed(seed); }
public List<Pair<Position, String>> pp() { List<Pair<Position, String>> res = new ArrayList<>(); for(Correlation correlation : correlations) { res.add(Pair.make(correlation.getStartPosition(positions), correlation.pp(positions))); } return res; }
public CallVertex makeCallVertex(FuncVertex func, JavaScriptInvoke invk) { CallSiteReference site = invk.getCallSite(); Pair<FuncVertex, CallSiteReference> key = Pair.make(func, site); CallVertex value = callVertexCache.get(key); if(value == null) callVertexCache.put(key, value = new CallVertex(func, site, invk)); return value; }
public List<Pair<Position, String>> pp() { List<Pair<Position, String>> res = new ArrayList<>(); for(Correlation correlation : correlations) { res.add(Pair.make(correlation.getStartPosition(positions), correlation.pp(positions))); } return res; }
private IMethod makeNumberCall(IClass cls, int nargs) { assert nargs == 0 || nargs == 1; Object key = Pair.make(cls, Integer.valueOf(nargs)); if (constructors.containsKey(key)) return constructors.get(key); else return record(key, (nargs == 0) ? makeNullaryNumberCall(cls) : makeUnaryNumberCall(cls)); }
private IMethod makeValueConstructor(IClass cls, int nargs, Object value) { if (nargs == 0 || nargs == 1) { Object key = Pair.make(cls, Integer.valueOf(nargs)); if (constructors.containsKey(key)) return constructors.get(key); else return record(key, (nargs == 0) ? makeNullaryValueConstructor(cls, value) : makeUnaryValueConstructor(cls)); } else { // not a legal call, likely due to dataflow imprecision return null; } }
private CAstNode copyConstant(CAstNode root, NodePos context, Map<Pair<CAstNode, NoKey>, CAstNode> nodeMap) { CAstNode newNode = Ast.makeConstant(root.getValue()); nodeMap.put(Pair.make(root, context.key()), newNode); return newNode; }
@Override public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) { CGNode cgn = CG.getNode(node, Everywhere.EVERYWHERE); assert cgn != null : node; return NonNullSingletonIterator.make(Pair.make(cgn, NewSiteReference.make(instructionIndex, createdType))); }
public Pair<Integer, String> getBodyText() { Segment content = innerElement.getContent(); Integer lineNum = innerElement.getSource().getRow(content.getBegin()); String nl = content.getSource().getNewLine(); String body = nl==null? content.toString(): content.toString().replace(nl, "\n"); return Pair.make(lineNum, body); }
public Pair<Integer, String> getBodyText() { Segment content = innerElement.getContent(); Integer lineNum = innerElement.getSource().getRow(content.getBegin()); String nl = content.getSource().getNewLine(); String body = nl==null? content.toString(): content.toString().replace(nl, "\n"); return Pair.make(lineNum, body); }
@Override public Iterator<? extends Pair<CGNode, NewSiteReference>> makeInner(final CGNode outer) { return new MapIterator<>( new FilterIterator<>( outer.iterateNewSites(), o -> o.getDeclaredType().equals(type.getReference()) ), object -> Pair.make(outer, object)); } };
private static Pair<CallGraph,PointerAnalysis<InstanceKey>> makeJavaBuilder(String scopeFile, String mainClass) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(scopeFile, CallGraphTestUtil.REGRESSION_EXCLUSIONS); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph CG = builder.makeCallGraph(options); return Pair.make(CG, builder.getPointerAnalysis()); }