/** * @return the program counter (index into the method's bytecode) for this call site. */ public int getProgramCounter() { return site.getProgramCounter(); }
/** * Return the instruction indices corresponding to a call site. * * Note that Shrike may inline JSRS. This can lead to multiple copies of a single bytecode instruction in a particular IR. So we * may have more than one instruction index for a particular call site from bytecode. */ public IntSet getCallInstructionIndices(CallSiteReference site) { if (site == null) { throw new IllegalArgumentException("site is null"); } return callSiteMapping.getRelated(site.getProgramCounter()); }
/** * Return the instruction indices corresponding to a call site. * * Note that Shrike may inline JSRS. This can lead to multiple copies of a single bytecode instruction in a particular IR. So we * may have more than one instruction index for a particular call site from bytecode. */ public IntSet getCallInstructionIndices(CallSiteReference site) { if (site == null) { throw new IllegalArgumentException("site is null"); } return callSiteMapping.getRelated(site.getProgramCounter()); }
@Override public String toString() { StringBuilder str = new StringBuilder("["); for (int i = 0; i < sites.length; i++) { str.append(' ').append(methods[i].getSignature()).append('@').append(sites[i].getProgramCounter()); } str.append(" ]"); return str.toString(); }
@Override public String toString() { StringBuilder str = new StringBuilder("["); for (int i = 0; i < sites.length; i++) { str.append(' ').append(methods[i].getSignature()).append('@').append(sites[i].getProgramCounter()); } str.append(" ]"); return str.toString(); }
protected int getNumberOfTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result == null) { return 0; } else if (result instanceof CGNode) { return 1; } else { return ((IntSet) result).size(); } }
public static boolean hasExposedUses(CGNode caller, CallSiteReference site) { int uses[] = ((AstMethod) caller.getMethod()).lexicalInfo().getExposedUses(site.getProgramCounter()); if (uses != null && uses.length > 0) { for (int use : uses) { if (use > 0) { return true; } } } return false; } }
public static boolean hasExposedUses(CGNode caller, CallSiteReference site) { int uses[] = ((AstMethod) caller.getMethod()).lexicalInfo().getExposedUses(site.getProgramCounter()); if (uses != null && uses.length > 0) { for (int use : uses) { if (use > 0) { return true; } } } return false; } }
protected IntSet getPossibleTargetNumbers(CallSiteReference site) { Object t = targets.get(site.getProgramCounter()); if (t == null) { return null; } else if (t instanceof CGNode) { return SparseIntSet.singleton(getCallGraph().getNumber((CGNode) t)); } else { return (IntSet) t; } }
@Override public IntSet getPossibleTargetNumbers(CallSiteReference site) { Object t = targets.get(site.getProgramCounter()); if (t != null && t instanceof CallSite) { CallSite p = (CallSite) t; DelegatingCGNode n = (DelegatingCGNode) p.getNode(); CallSiteReference s = p.getSite(); return n.getPossibleTargetNumbers(s); } else { return super.getPossibleTargetNumbers(site); } }
@Override public int getNumberOfTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result != null && result instanceof CallSite) { CallSite p = (CallSite) result; CGNode n = p.getNode(); CallSiteReference s = p.getSite(); return DelegatingExplicitCallGraph.this.getNumberOfTargets(n,s); } else { return super.getNumberOfTargets(site); } }
public static void serializeCallSite(AstMethod method, CallSiteReference callsite, Set<IMethod> targets, Map<String, Set<String>> edges) { Set<String> targetNames = MapUtil.findOrCreateSet(edges, ppPos(method.getSourcePosition(callsite.getProgramCounter()))); for(IMethod target : targets) { target = getCallTargetMethod(target); if(!isRealFunction(target)) continue; targetNames.add(ppPos(((AstMethod)target).getSourcePosition())); } }
@Override public Set<CGNode> getPossibleTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result != null && result instanceof CallSite) { CallSite p = (CallSite) result; CGNode n = p.getNode(); CallSiteReference s = p.getSite(); return DelegatingExplicitCallGraph.this.getPossibleTargets(n, s); } else { return super.getPossibleTargets(site); } }
public static void serializeCallSite(AstMethod method, CallSiteReference callsite, Set<IMethod> targets, Map<String, Set<String>> edges) { Set<String> targetNames = MapUtil.findOrCreateSet(edges, ppPos(method.getSourcePosition(callsite.getProgramCounter()))); for(IMethod target : targets) { target = getCallTargetMethod(target); if(!isRealFunction(target)) continue; targetNames.add(ppPos(((AstMethod)target).getSourcePosition())); } }
@Override public IntSet getPossibleTargetNumbers(CallSiteReference site) { Object t = targets.get(site.getProgramCounter()); if (t != null && t instanceof CallSite) { CallSite p = (CallSite) t; DelegatingCGNode n = (DelegatingCGNode) p.getNode(); CallSiteReference s = p.getSite(); return n.getPossibleTargetNumbers(s); } else { return super.getPossibleTargetNumbers(site); } }
@Override public Set<CGNode> getPossibleTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result != null && result instanceof CallSite) { CallSite p = (CallSite) result; CGNode n = p.getNode(); CallSiteReference s = p.getSite(); return DelegatingExplicitCallGraph.this.getPossibleTargets(n, s); } else { return super.getPossibleTargets(site); } }
@Override public int getNumberOfTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result != null && result instanceof CallSite) { CallSite p = (CallSite) result; CGNode n = p.getNode(); CallSiteReference s = p.getSite(); return DelegatingExplicitCallGraph.this.getNumberOfTargets(n,s); } else { return super.getNumberOfTargets(site); } }
/** * get the {@link CallSiteReference} corresponding to the last instruction in B (assumed to be a call) */ protected CallSiteReference getCallSiteForCallBlock(IBasicBlock<SSAInstruction> B, ControlFlowGraph<SSAInstruction, T> cfg) { SSAInstruction[] statements = cfg.getInstructions(); SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction) statements[B.getLastInstructionIndex()]; int pc = cfg.getProgramCounter(B.getLastInstructionIndex()); CallSiteReference site = call.getCallSite(); assert site.getProgramCounter() == pc; return site; }
public void delegate(CallSiteReference site, CGNode delegateNode, CallSiteReference delegateSite) { CallSite d = new CallSite(delegateSite, delegateNode); targets.set(site.getProgramCounter(), d); int y = getCallGraph().getNumber(this); int x = getCallGraph().getNumber(delegateNode); delegateR.add(x, y); } }
public void delegate(CallSiteReference site, CGNode delegateNode, CallSiteReference delegateSite) { CallSite d = new CallSite(delegateSite, delegateNode); targets.set(site.getProgramCounter(), d); int y = getCallGraph().getNumber(this); int x = getCallGraph().getNumber(delegateNode); delegateR.add(x, y); } }