/** * Might this call dispatch to one of several possible methods? i.e., in Java, is it an invokeinterface or invokevirtual */ public boolean isDispatch() { return getCallSite().isDispatch(); }
/** * Might this call dispatch to one of several possible methods? i.e., in Java, is it an invokeinterface or invokevirtual */ public boolean isDispatch() { return getCallSite().isDispatch(); }
@Override public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) { if (site.isDispatch() || site.getDeclaredTarget().getNumberOfParameters() > 0) { return thisParameter; } else { return EmptyIntSet.instance; } }
@Override public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) { if (site.isDispatch() || site.getDeclaredTarget().getNumberOfParameters() > 0) { return thisParameter; } else { return EmptyIntSet.instance; } }
private Iterator<IMethod> getPossibleTargets(CallSiteReference site) { Set<IMethod> result = targetCache.get(site); if (result == null) { if (site.isDispatch()) { result = cha.getPossibleTargets(site.getDeclaredTarget()); } else { IMethod m = cha.resolveMethod(site.getDeclaredTarget()); if (m != null) { result = Collections.singleton(m); } else { result = Collections.emptySet(); } } targetCache.put(site, result); } return result.iterator(); }
private Iterator<IMethod> getPossibleTargets(CallSiteReference site) { Set<IMethod> result = targetCache.get(site); if (result == null) { if (site.isDispatch()) { result = cha.getPossibleTargets(site.getDeclaredTarget()); } else { IMethod m = cha.resolveMethod(site.getDeclaredTarget()); if (m != null) { result = Collections.singleton(m); } else { result = Collections.emptySet(); } } targetCache.put(site, result); } return result.iterator(); }
protected Set<CGNode> getTargetsForCall(final CGNode caller, final SSAAbstractInvokeInstruction instruction, InstanceKey[][] invs) { // This method used to take a CallSiteReference as a parameter, rather than // an SSAAbstractInvokeInstruction. This was bad, since it's // possible for multiple invoke instructions with different actual // parameters to be associated with a single CallSiteReference. Changed // to take the invoke instruction as a parameter instead, since invs is // associated with the instruction final CallSiteReference site = instruction.getCallSite(); final Set<CGNode> targets = HashSetFactory.make(); Consumer<InstanceKey[]> f = v -> { IClass recv = null; if (site.isDispatch()) { recv = v[0].getConcreteType(); } CGNode target = getTargetForCall(caller, site, recv, v); if (target != null) { targets.add(target); } }; iterateCrossProduct(caller, instruction, invs, f); return targets; }
protected Set<CGNode> getTargetsForCall(final CGNode caller, final SSAAbstractInvokeInstruction instruction, InstanceKey[][] invs) { // This method used to take a CallSiteReference as a parameter, rather than // an SSAAbstractInvokeInstruction. This was bad, since it's // possible for multiple invoke instructions with different actual // parameters to be associated with a single CallSiteReference. Changed // to take the invoke instruction as a parameter instead, since invs is // associated with the instruction final CallSiteReference site = instruction.getCallSite(); final Set<CGNode> targets = HashSetFactory.make(); Consumer<InstanceKey[]> f = v -> { IClass recv = null; if (site.isDispatch()) { recv = v[0].getConcreteType(); } CGNode target = getTargetForCall(caller, site, recv, v); if (target != null) { targets.add(target); } }; iterateCrossProduct(caller, instruction, invs, f); return targets; }
/** * This target selector searches the class hierarchy for the method matching the signature of the call that is appropriate for the * receiver type. * * @throws IllegalArgumentException if call is null */ @Override public IMethod getCalleeTarget(CGNode caller, CallSiteReference call, IClass receiver) { if (call == null) { throw new IllegalArgumentException("call is null"); } IClass klass; TypeReference targetType = call.getDeclaredTarget().getDeclaringClass(); // java virtual calls if (call.isDispatch()) { assert receiver != null : "null receiver for " + call; klass = receiver; // java static calls } else if (call.isFixed()) { klass = classHierarchy.lookupClass(targetType); if (klass == null) { return null; } // anything else } else { return null; } return classHierarchy.resolveMethod(klass, call.getDeclaredTarget().getSelector()); }
/** * This target selector searches the class hierarchy for the method matching the signature of the call that is appropriate for the * receiver type. * * @throws IllegalArgumentException if call is null */ @Override public IMethod getCalleeTarget(CGNode caller, CallSiteReference call, IClass receiver) { if (call == null) { throw new IllegalArgumentException("call is null"); } IClass klass; TypeReference targetType = call.getDeclaredTarget().getDeclaringClass(); // java virtual calls if (call.isDispatch()) { assert receiver != null : "null receiver for " + call; klass = receiver; // java static calls } else if (call.isFixed()) { klass = classHierarchy.lookupClass(targetType); if (klass == null) { return null; } // anything else } else { return null; } return classHierarchy.resolveMethod(klass, call.getDeclaredTarget().getSelector()); }
v -> { IClass recv = null; if (call.getCallSite().isDispatch()) { recv = v[0].getConcreteType();
v -> { IClass recv = null; if (call.getCallSite().isDispatch()) { recv = v[0].getConcreteType();