Package soot.dexpler.instructions
Class MethodInvocationInstruction
- java.lang.Object
-
- soot.dexpler.instructions.DexlibAbstractInstruction
-
- soot.dexpler.instructions.MethodInvocationInstruction
-
- All Implemented Interfaces:
DanglingInstruction
- Direct Known Subclasses:
ExecuteInlineInstruction,InvokeCustomInstruction,InvokeInterfaceInstruction,InvokePolymorphicInstruction,InvokeSpecialInstruction,InvokeStaticInstruction,InvokeVirtualInstruction
public abstract class MethodInvocationInstruction extends DexlibAbstractInstruction implements DanglingInstruction
-
-
Field Summary
Fields Modifier and Type Field Description protected AssignStmtassignprotected InvokeExprinvocation-
Fields inherited from class soot.dexpler.instructions.DexlibAbstractInstruction
codeAddress, instruction, lineNumber, unit
-
-
Constructor Summary
Constructors Constructor Description MethodInvocationInstruction(org.jf.dexlib2.iface.instruction.Instruction instruction, int codeAddress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<Local>buildParameters(DexBody body, List<? extends CharSequence> paramTypes, boolean isStatic)Build the local parameters of the invocation.protected SootClassconvertClassName(String name, MethodHandle.Kind kind)Converts a given string class name into a SootClass.protected List<Type>convertParameterTypes(List<? extends CharSequence> paramTypes)Converts a list of dex string parameter types to soot types.voidfinalize(DexBody body, DexlibAbstractInstruction successor)Finalize this instruction taking the successor into consideration.protected SootMethodRefgetInterfaceSootMethodRef()Return the static SootMethodRef for the invoked method.protected SootMethodRefgetNormalSootMethodRef(MethodHandle.Kind kind)Return the SootMethodRef for the invoked method.protected SootFieldRefgetSootFieldRef(org.jf.dexlib2.iface.reference.FieldReference mItem, MethodHandle.Kind kind)Return a SootFieldRef for the given data.protected SootFieldRefgetSootFieldRef(SootClass sc, String name, String type, MethodHandle.Kind kind)Return a SootFieldRef for the given data.protected SootMethodRefgetSootMethodRef(org.jf.dexlib2.iface.reference.MethodReference mItem, MethodHandle.Kind kind)Return a SootMethodRef for the given MethodReference dependent on the InvocationType passed in.protected SootMethodRefgetSootMethodRef(SootClass sc, String name, String returnType, List<? extends CharSequence> paramTypes, MethodHandle.Kind kind)Return a SootMethodRef for the given data.protected SootMethodRefgetStaticSootMethodRef()Return the static SootMethodRef for the invoked method.protected List<Integer>getUsedRegistersNums()Return the indices used in this instruction.protected SootMethodRefgetVirtualSootMethodRef()Return the virtual SootMethodRef for the invoked method.Set<Type>introducedTypes()Return the types that are be introduced by this instruction.protected booleanisUsedAsFloatingPoint(DexBody body, int register, boolean isStatic)Determine if register is used as floating point.protected booleanisUsedAsObject(DexBody body, int register, boolean isStatic)Determine if register is used as object.protected voidjimplifyInterface(DexBody body)Executes the "jimplify" operation for an interface invocationprotected voidjimplifySpecial(DexBody body)Executes the "jimplify" operation for a special invocationprotected voidjimplifyStatic(DexBody body)Executes the "jimplify" operation for a static invocationprotected voidjimplifyVirtual(DexBody body)Executes the "jimplify" operation for a virtual invocation-
Methods inherited from class soot.dexpler.instructions.DexlibAbstractInstruction
addTags, getInstruction, getLineNumber, getUnit, getUsedRegistersNums, getUsedRegistersNums, jimplify, setLineNumber, setUnit
-
-
-
-
Field Detail
-
invocation
protected InvokeExpr invocation
-
assign
protected AssignStmt assign
-
-
Method Detail
-
finalize
public void finalize(DexBody body, DexlibAbstractInstruction successor)
Description copied from interface:DanglingInstructionFinalize this instruction taking the successor into consideration.- Specified by:
finalizein interfaceDanglingInstruction- Parameters:
body- to finalize intosuccessor- the direct successor of this instruction
-
introducedTypes
public Set<Type> introducedTypes()
Description copied from class:DexlibAbstractInstructionReturn the types that are be introduced by this instruction. Instructions that may introduce types should override this.- Overrides:
introducedTypesin classDexlibAbstractInstruction
-
isUsedAsFloatingPoint
protected boolean isUsedAsFloatingPoint(DexBody body, int register, boolean isStatic)
Determine if register is used as floating point. Abstraction for static and non-static methods. Non-static methods need to ignore the first parameter (this)- Parameters:
isStatic- if this method is static
-
isUsedAsObject
protected boolean isUsedAsObject(DexBody body, int register, boolean isStatic)
Determine if register is used as object. Abstraction for static and non-static methods. Non-static methods need to ignore the first parameter (this)- Parameters:
isStatic- if this method is static
-
getVirtualSootMethodRef
protected SootMethodRef getVirtualSootMethodRef()
Return the virtual SootMethodRef for the invoked method.
-
getStaticSootMethodRef
protected SootMethodRef getStaticSootMethodRef()
Return the static SootMethodRef for the invoked method.
-
getInterfaceSootMethodRef
protected SootMethodRef getInterfaceSootMethodRef()
Return the static SootMethodRef for the invoked method.
-
getNormalSootMethodRef
protected SootMethodRef getNormalSootMethodRef(MethodHandle.Kind kind)
Return the SootMethodRef for the invoked method.- Parameters:
kind- The type of the invocation in terms of MethodHandle.Kind
-
getSootMethodRef
protected SootMethodRef getSootMethodRef(org.jf.dexlib2.iface.reference.MethodReference mItem, MethodHandle.Kind kind)
Return a SootMethodRef for the given MethodReference dependent on the InvocationType passed in.- Parameters:
mItem- The MethodReference included in the invoke instructionkind- The type of the invocation in terms of MethodHandle.Kind- Returns:
- A SootMethodRef
-
getSootMethodRef
protected SootMethodRef getSootMethodRef(SootClass sc, String name, String returnType, List<? extends CharSequence> paramTypes, MethodHandle.Kind kind)
Return a SootMethodRef for the given data.- Parameters:
sc- The SootClass that the method is declared inname- The name of the method being invokedreturnType- The return type of the method being invokedparamTypes- The parameter types of the method being invokedkind- The type of the invocation in terms of MethodHandle.Kind- Returns:
- A SootMethodRef
-
getSootFieldRef
protected SootFieldRef getSootFieldRef(org.jf.dexlib2.iface.reference.FieldReference mItem, MethodHandle.Kind kind)
Return a SootFieldRef for the given data.- Parameters:
mItem- The FieldReference included in the invoke instructionkind- The type of the field access in terms of MethodHandle.Kind- Returns:
- A SootFieldRef
-
getSootFieldRef
protected SootFieldRef getSootFieldRef(SootClass sc, String name, String type, MethodHandle.Kind kind)
Return a SootFieldRef for the given data.- Parameters:
sc- The SootClass that the field is declared inname- The name of the fieldtype- The type of the fieldkind- The type of the field access in terms of MethodHandle.Kind- Returns:
- A SootFieldRef
-
convertParameterTypes
protected List<Type> convertParameterTypes(List<? extends CharSequence> paramTypes)
Converts a list of dex string parameter types to soot types.- Parameters:
paramTypes- The dex parameter types- Returns:
- The soot parameter types
-
convertClassName
protected SootClass convertClassName(String name, MethodHandle.Kind kind)
Converts a given string class name into a SootClass.- Parameters:
name- The dex string representation of the classkind- The MethodHandle.Kind of the MethodHandle this class is coming from- Returns:
-
buildParameters
protected List<Local> buildParameters(DexBody body, List<? extends CharSequence> paramTypes, boolean isStatic)
Build the local parameters of the invocation. If a method is not static then its first register value is the invoking object and will be skipped when constructing the local parameters.- Parameters:
body- the body to build for and intoparamTypes- the parameter types as stringsisStatic- if the method is static- Returns:
- the converted parameters
-
getUsedRegistersNums
protected List<Integer> getUsedRegistersNums()
Return the indices used in this instruction.- Returns:
- a list of register indices
-
jimplifyVirtual
protected void jimplifyVirtual(DexBody body)
Executes the "jimplify" operation for a virtual invocation
-
jimplifyInterface
protected void jimplifyInterface(DexBody body)
Executes the "jimplify" operation for an interface invocation
-
jimplifySpecial
protected void jimplifySpecial(DexBody body)
Executes the "jimplify" operation for a special invocation
-
jimplifyStatic
protected void jimplifyStatic(DexBody body)
Executes the "jimplify" operation for a static invocation
-
-