@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site, LocalPointerKey actualPk) { return cg.getPossibleTargets(node, site); }
@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site, LocalPointerKey actualPk) { return cg.getPossibleTargets(node, site); }
/** * @return the set of CGNodes that B may call, according to the governing call graph. */ private Set<CGNode> getCallTargets(IBasicBlock<SSAInstruction> B, ControlFlowGraph<SSAInstruction, T> cfg, CGNode Bnode) { CallSiteReference site = getCallSiteForCallBlock(B, cfg); return cg.getPossibleTargets(Bnode, site); }
/** * @return the set of CGNodes that B may call, according to the governing call graph. */ private Set<CGNode> getCallTargets(IBasicBlock<SSAInstruction> B, ControlFlowGraph<SSAInstruction, T> cfg, CGNode Bnode) { CallSiteReference site = getCallSiteForCallBlock(B, cfg); return cg.getPossibleTargets(Bnode, site); }
@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site) { if (!keep.contains(node)){ return null; } Set<CGNode> tmp = cg.getPossibleTargets(node, site); Set<CGNode> ret = new HashSet<>(); for (CGNode n : tmp) { if (keep.contains(n) && !removedEdge(node, n)) { ret.add(n); } } return ret; }
@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site) { if (!keep.contains(node)){ return null; } Set<CGNode> tmp = cg.getPossibleTargets(node, site); Set<CGNode> ret = new HashSet<>(); for (CGNode n : tmp) { if (keep.contains(n) && !removedEdge(node, n)) { ret.add(n); } } return ret; }
@Override public boolean throwsException(final SSAAbstractInvokeInstruction node) { for (final CGNode called : cg.getPossibleTargets(method, node.getCallSite())) { final IntraprocAnalysisState info = map.get(called); if (info == null || info.hasExceptions()) { return true; } } return false; }
@Override public void visitInvoke(SSAInvokeInstruction instruction) { CallSiteReference site = instruction.getCallSite(); Set<CGNode> targets = cg.getPossibleTargets(node, site); for (CGNode target : targets) { thrown.addAll(getCGNodeExceptions(target)); } } });
@Override public void visitInvoke(SSAInvokeInstruction instruction) { CallSiteReference site = instruction.getCallSite(); Set<CGNode> targets = cg.getPossibleTargets(node, site); for (CGNode target : targets) { thrown.addAll(getCGNodeExceptions(target)); } } });
public static String nodeToString(CallGraph CG, CGNode n) { StringBuilder result = new StringBuilder(n.toString() + '\n'); if (n.getMethod() != null) { for (CallSiteReference site : Iterator2Iterable.make(n.iterateCallSites())) { Iterator<CGNode> targets = CG.getPossibleTargets(n, site).iterator(); if (targets.hasNext()) { result.append(" - ").append(site).append('\n'); } for (CGNode target : Iterator2Iterable.make(targets)) { result.append(" -> ").append(target).append('\n'); } } } return result.toString(); }
public static String nodeToString(CallGraph CG, CGNode n) { StringBuilder result = new StringBuilder(n.toString() + '\n'); if (n.getMethod() != null) { for (CallSiteReference site : Iterator2Iterable.make(n.iterateCallSites())) { Iterator<CGNode> targets = CG.getPossibleTargets(n, site).iterator(); if (targets.hasNext()) { result.append(" - ").append(site).append('\n'); } for (CGNode target : Iterator2Iterable.make(targets)) { result.append(" -> ").append(target).append('\n'); } } } return result.toString(); }
@Override public boolean throwsException(final SSAAbstractInvokeInstruction node) { for (final CGNode called : cg.getPossibleTargets(method, node.getCallSite())) { final IntraprocAnalysisState info = map.get(called); if (info == null || info.hasExceptions()) { return true; } } return false; }
@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site) { if (!containsNode(node)) { return null; } Set<CGNode> result = HashSetFactory.make(); for (CGNode target : cg.getPossibleTargets(node, site)) { if (containsNode(target)) { result.add(target); } } return result; } }
@Override public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site) { if (!containsNode(node)) { return null; } Set<CGNode> result = HashSetFactory.make(); for (CGNode target : cg.getPossibleTargets(node, site)) { if (containsNode(target)) { result.add(target); } } return result; } }
/** * @return the set of all locations read by any callee at a call site. */ private static OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call, Map<CGNode, OrdinalSet<PointerKey>> loc) { BitVectorIntSet bv = new BitVectorIntSet(); for (CGNode t : cg.getPossibleTargets(n, call.getCallSite())) { bv.addAll(loc.get(t).getBackingSet()); } return new OrdinalSet<>(bv, loc.get(n).getMapping()); }
/** * @return the set of all locations read by any callee at a call site. */ private static OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call, Map<CGNode, OrdinalSet<PointerKey>> loc) { BitVectorIntSet bv = new BitVectorIntSet(); for (CGNode t : cg.getPossibleTargets(n, call.getCallSite())) { bv.addAll(loc.get(t).getBackingSet()); } return new OrdinalSet<>(bv, loc.get(n).getMapping()); }
public static Map<String, Set<String>> extractEdges(CallGraph cg) { Map<String, Set<String>> edges = HashMapFactory.make(); for(CGNode nd : cg) { if(!isRealFunction(nd.getMethod())) continue; AstMethod method = (AstMethod)nd.getMethod(); for(CallSiteReference callsite : Iterator2Iterable.make(nd.iterateCallSites())) { Set<IMethod> targets = Util.mapToSet(cg.getPossibleTargets(nd, callsite), CGNode::getMethod); serializeCallSite(method, callsite, targets, edges); } } return edges; }
public static Map<String, Set<String>> extractEdges(CallGraph cg) { Map<String, Set<String>> edges = HashMapFactory.make(); for(CGNode nd : cg) { if(!isRealFunction(nd.getMethod())) continue; AstMethod method = (AstMethod)nd.getMethod(); for(CallSiteReference callsite : Iterator2Iterable.make(nd.iterateCallSites())) { Set<IMethod> targets = Util.mapToSet(cg.getPossibleTargets(nd, callsite), CGNode::getMethod); serializeCallSite(method, callsite, targets, edges); } } return edges; }
/** * @return the points-to set for the exceptional return values from a particular call site */ private OrdinalSet<InstanceKey> computeImplicitExceptionsForCall(CGNode node, SSAInvokeInstruction call) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (CGNode target : getCallGraph().getPossibleTargets(node, call.getCallSite())) { PointerKey retVal = pointerKeys.getPointerKeyForExceptionalReturnValue(target); IntSet set = getPointsToSet(retVal).getBackingSet(); if (set != null) { S.addAll(set); } } return new OrdinalSet<>(S, instanceKeys); }
/** * @return the points-to set for the exceptional return values from a particular call site */ private OrdinalSet<InstanceKey> computeImplicitExceptionsForCall(CGNode node, SSAInvokeInstruction call) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (CGNode target : getCallGraph().getPossibleTargets(node, call.getCallSite())) { PointerKey retVal = pointerKeys.getPointerKeyForExceptionalReturnValue(target); IntSet set = getPointsToSet(retVal).getBackingSet(); if (set != null) { S.addAll(set); } } return new OrdinalSet<>(S, instanceKeys); }