/** * Is this an invokespecial call site? */ public final boolean isSpecial() { return (getInvocationCode() == IInvokeInstruction.Dispatch.SPECIAL); }
/** * @see com.ibm.wala.classLoader.CallSiteReference#getInvocationCode() */ public IInvokeInstruction.IDispatch getInvocationCode() { return site.getInvocationCode(); }
/** * Is this an invokeinterface call site? */ public final boolean isInterface() { return (getInvocationCode() == IInvokeInstruction.Dispatch.INTERFACE); }
/** * Is this an invokeinterface call site? */ public final boolean isInterface() { return (getInvocationCode() == IInvokeInstruction.Dispatch.INTERFACE); }
/** * Is this an invokevirtual call site? */ public final boolean isVirtual() { return (getInvocationCode() == IInvokeInstruction.Dispatch.VIRTUAL); }
/** * Is this an invokevirtual call site? */ public final boolean isVirtual() { return (getInvocationCode() == IInvokeInstruction.Dispatch.VIRTUAL); }
/** * Is this an invokespecial call site? */ public final boolean isSpecial() { return (getInvocationCode() == IInvokeInstruction.Dispatch.SPECIAL); }
/** * Is this an invokestatic call site? */ public boolean isStatic() { return (getInvocationCode() == IInvokeInstruction.Dispatch.STATIC); }
/** * Is this an invokestatic call site? */ public boolean isStatic() { return (getInvocationCode() == IInvokeInstruction.Dispatch.STATIC); }
/** * @see com.ibm.wala.classLoader.CallSiteReference#getInvocationCode() */ public IInvokeInstruction.IDispatch getInvocationCode() { return site.getInvocationCode(); }
/** * @see com.ibm.wala.ssa.SSAInstruction#getNumberOfUses() */ @Override public int getNumberOfUses() { if (params == null) { assert site.getInvocationCode() == IInvokeInstruction.Dispatch.STATIC || site.getInvocationCode() == IInvokeInstruction.Dispatch.SPECIAL; assert site.getDeclaredTarget().getNumberOfParameters() == 0; return 0; } else { return params.length; } }
public String getInvocationString() { return getInvocationString(getInvocationCode()); }
public String getInvocationString() { return getInvocationString(getInvocationCode()); }
/** * @see com.ibm.wala.ssa.SSAInstruction#getNumberOfUses() */ @Override public int getNumberOfUses() { if (params == null) { assert site.getInvocationCode() == IInvokeInstruction.Dispatch.STATIC || site.getInvocationCode() == IInvokeInstruction.Dispatch.SPECIAL; assert site.getDeclaredTarget().getNumberOfParameters() == 0; return 0; } else { return params.length; } }
/** * @return the value number of the receiver of a virtual call */ public int getReceiver() { assert site.getInvocationCode() != IInvokeInstruction.Dispatch.STATIC : toString(); return getUse(0); }
/** * @return the value number of the receiver of a virtual call */ public int getReceiver() { assert site.getInvocationCode() != IInvokeInstruction.Dispatch.STATIC : toString(); return getUse(0); }
@Override public String toString() { return "invoke" + getInvocationString(getInvocationCode()) + ' ' + declaredTarget + '@' + getProgramCounter(); }
@Override public String toString() { return "invoke" + getInvocationString(getInvocationCode()) + ' ' + declaredTarget + '@' + getProgramCounter(); }
public SSAAbstractInvokeInstruction addInvocation(int[] params, CallSiteReference site) { if (site == null) { throw new IllegalArgumentException("site is null"); } CallSiteReference newSite = CallSiteReference.make(methodSummary.getNumberOfStatements(), site.getDeclaredTarget(), site.getInvocationCode()); SSAAbstractInvokeInstruction s = null; if (newSite.getDeclaredTarget().getReturnType().equals(TypeReference.Void)) { s = insts.InvokeInstruction(methodSummary.getNumberOfStatements(), params, nextLocal++, newSite, null); } else { s = insts.InvokeInstruction(methodSummary.getNumberOfStatements(), nextLocal++, params, nextLocal++, newSite, null); } methodSummary.addStatement(s); // cache.invalidate(this, Everywhere.EVERYWHERE); return s; }
@Override protected void doCall(WalkContext context, CAstNode call, int result, int exception, CAstNode name, int receiver, int[] arguments) { assert name.getKind() == CAstNode.CONSTANT; CallSiteReference dummySiteRef = (CallSiteReference) name.getValue(); int pc = context.cfg().getCurrentInstruction(); boolean isStatic = (receiver == -1); int[] realArgs = isStatic ? arguments : new int[arguments.length + 1]; if (!isStatic) { realArgs[0] = receiver; System.arraycopy(arguments, 0, realArgs, 1, arguments.length); } CallSiteReference realSiteRef = CallSiteReference.make(pc, dummySiteRef.getDeclaredTarget(), dummySiteRef.getInvocationCode()); if (realSiteRef.getDeclaredTarget().getReturnType().equals(TypeReference.Void)) context.cfg().addInstruction(new AstJavaInvokeInstruction(context.cfg().getCurrentInstruction(), realArgs, exception, realSiteRef)); else context.cfg().addInstruction(new AstJavaInvokeInstruction(context.cfg().getCurrentInstruction(), result, realArgs, exception, realSiteRef)); processExceptions(call, context); }