Class InvokePolymorphicInsn

java.lang.Object
com.android.dx.rop.code.Insn
com.android.dx.rop.code.InvokePolymorphicInsn
All Implemented Interfaces:
ToHuman

public class InvokePolymorphicInsn extends Insn
An invoke-polymorphic instruction. This is a throwing instruction with multiple constants.
  • Constructor Details

    • InvokePolymorphicInsn

      public InvokePolymorphicInsn(Rop opcode, SourcePosition position, RegisterSpecList sources, TypeList catches, CstMethodRef callSiteMethod)
      Constructs an instance.
      Parameters:
      opcode - non-null; the opcode
      position - non-null; source position
      sources - non-null; specs for all the sources
      catches - non-null; list of exceptions caught
      callSiteMethod - non-null; the method called by invoke-virtual that this instance will replace.
  • Method Details

    • getCatches

      public TypeList getCatches()
      Gets the list of possibly-caught exceptions. This returns StdTypeList.EMPTY if this instruction has no handlers, which can be either if this instruction can't possibly throw or if it merely doesn't handle any of its possible exceptions. To determine whether this instruction can throw, use Insn.canThrow().
      Specified by:
      getCatches in class Insn
      Returns:
      non-null; the catches list
    • accept

      public void accept(Insn.Visitor visitor)
      Calls the appropriate method on the given visitor, depending on the class of this instance. Subclasses must override this.
      Specified by:
      accept in class Insn
      Parameters:
      visitor - non-null; the visitor to call on
    • withAddedCatch

      public Insn withAddedCatch(Type type)
      Returns an instance that is just like this one, except that it has a catch list with the given item appended to the end. This method throws an exception if this instance can't possibly throw. To determine whether this instruction can throw, use Insn.canThrow().
      Specified by:
      withAddedCatch in class Insn
      Parameters:
      type - non-null; type to append to the catch list
      Returns:
      non-null; an appropriately-constructed instance
    • withRegisterOffset

      public Insn withRegisterOffset(int delta)
      Returns an instance that is just like this one, except that all register references have been offset by the given delta.
      Specified by:
      withRegisterOffset in class Insn
      Parameters:
      delta - the amount to offset register references by
      Returns:
      non-null; an appropriately-constructed instance
    • withNewRegisters

      public Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources)
      Returns an instance that is just like this one, except with new result and source registers.
      Specified by:
      withNewRegisters in class Insn
      Parameters:
      result - null-ok; new result register
      sources - non-null; new sources registers
      Returns:
      non-null; an appropriately-constructed instance
    • getCallSiteMethod

      public CstMethodRef getCallSiteMethod()
      Gets the method as it appears at the call site of the original invoke-virtual instruction.
      Returns:
      non-null; the original method reference
    • getPolymorphicMethod

      public CstMethodRef getPolymorphicMethod()
      Gets the method to be invoked. This will be will either be java.lang.invoke.MethodHandle.invoke() or java.lang.invoke.MethodHandle.invokeExact().
      Returns:
      non-null; method reference to be invoked
    • getCallSiteProto

      public CstProtoRef getCallSiteProto()
      Gets the call site prototype. The call site prototype is provided as an argument to invoke-polymorphic to enable type checking and type conversion.
      Returns:
      non-null; Prototype reference for call site
    • getInlineString

      public String getInlineString()
      Gets an "inline" string portion for toHuman(), if available. This is the portion that appears after the Rop opcode
      Overrides:
      getInlineString in class Insn
      Returns:
      null-ok; if non-null, the inline text for toHuman()