Class Rop

java.lang.Object
com.android.dx.rop.code.Rop

public final class Rop extends Object
Class that describes all the immutable parts of register-based operations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    indicates an unconditional goto
    static final int
    indicates a two-way branch
    static final int
    maximum BRANCH_* value
    static final int
    minimum BRANCH_* value
    static final int
    indicates a non-branching op
    static final int
    indicates a function/method return
    static final int
    indicates a switch-style branch
    static final int
    indicates a throw-style branch (both always-throws and may-throw)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Rop(int opcode, TypeList sources, TypeList exceptions)
    Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (see isCallLike).
    Rop(int opcode, Type result, TypeList sources, int branchingness, String nickname)
    Constructs a no-exception instance.
    Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, boolean isCallLike, String nickname)
    Constructs an instance.
    Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, String nickname)
    Constructs an instance.
    Rop(int opcode, Type result, TypeList sources, TypeList exceptions, String nickname)
    Constructs a non-empty exceptions instance.
    Rop(int opcode, Type result, TypeList sources, String nickname)
    Constructs a non-branching no-exception instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Gets whether this operation can possibly throw an exception.
    boolean
    equals(Object other)
    int
    Gets the branchingness of this instance.
    Gets the list of exception types that might be thrown.
    Gets the nickname.
    int
    Gets the opcode.
    Gets the result type.
    Gets the source types.
    int
    boolean
    Gets whether this opcode is a function/method call or similar.
    boolean
    Gets whether this opcode is commutative (the order of its sources are unimportant) or not.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • BRANCH_MIN

      public static final int BRANCH_MIN
      minimum BRANCH_* value
      See Also:
    • BRANCH_NONE

      public static final int BRANCH_NONE
      indicates a non-branching op
      See Also:
    • BRANCH_RETURN

      public static final int BRANCH_RETURN
      indicates a function/method return
      See Also:
    • BRANCH_GOTO

      public static final int BRANCH_GOTO
      indicates an unconditional goto
      See Also:
    • BRANCH_IF

      public static final int BRANCH_IF
      indicates a two-way branch
      See Also:
    • BRANCH_SWITCH

      public static final int BRANCH_SWITCH
      indicates a switch-style branch
      See Also:
    • BRANCH_THROW

      public static final int BRANCH_THROW
      indicates a throw-style branch (both always-throws and may-throw)
      See Also:
    • BRANCH_MAX

      public static final int BRANCH_MAX
      maximum BRANCH_* value
      See Also:
  • Constructor Details

    • Rop

      public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, boolean isCallLike, String nickname)
      Constructs an instance. This method is private. Use one of the public constructors.
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      result - non-null; result type of this operation; Type.VOID for no-result operations
      sources - non-null; types of all the sources of this operation
      exceptions - non-null; list of possible types thrown by this operation
      branchingness - the branchingness of this op; one of the BRANCH_* constants
      isCallLike - whether the op is a function/method call or similar
      nickname - null-ok; optional nickname (used for debugging)
    • Rop

      public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, String nickname)
      Constructs an instance. The constructed instance is never a call-like op (see isCallLike).
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      result - non-null; result type of this operation; Type.VOID for no-result operations
      sources - non-null; types of all the sources of this operation
      exceptions - non-null; list of possible types thrown by this operation
      branchingness - the branchingness of this op; one of the BRANCH_* constants
      nickname - null-ok; optional nickname (used for debugging)
    • Rop

      public Rop(int opcode, Type result, TypeList sources, int branchingness, String nickname)
      Constructs a no-exception instance. The constructed instance is never a call-like op (see isCallLike).
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      result - non-null; result type of this operation; Type.VOID for no-result operations
      sources - non-null; types of all the sources of this operation
      branchingness - the branchingness of this op; one of the BRANCH_* constants
      nickname - null-ok; optional nickname (used for debugging)
    • Rop

      public Rop(int opcode, Type result, TypeList sources, String nickname)
      Constructs a non-branching no-exception instance. The branchingness is always BRANCH_NONE, and it is never a call-like op (see isCallLike).
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      result - non-null; result type of this operation; Type.VOID for no-result operations
      sources - non-null; types of all the sources of this operation
      nickname - null-ok; optional nickname (used for debugging)
    • Rop

      public Rop(int opcode, Type result, TypeList sources, TypeList exceptions, String nickname)
      Constructs a non-empty exceptions instance. Its branchingness is always BRANCH_THROW, but it is never a call-like op (see isCallLike).
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      result - non-null; result type of this operation; Type.VOID for no-result operations
      sources - non-null; types of all the sources of this operation
      exceptions - non-null; list of possible types thrown by this operation
      nickname - null-ok; optional nickname (used for debugging)
    • Rop

      public Rop(int opcode, TypeList sources, TypeList exceptions)
      Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (see isCallLike). Its branchingness is always BRANCH_THROW.
      Parameters:
      opcode - the opcode; one of the constants in RegOps
      sources - non-null; types of all the sources of this operation
      exceptions - non-null; list of possible types thrown by this operation
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOpcode

      public int getOpcode()
      Gets the opcode.
      Returns:
      the opcode
    • getResult

      public Type getResult()
      Gets the result type. A return value of Type.VOID means this operation returns nothing.
      Returns:
      null-ok; the result spec
    • getSources

      public TypeList getSources()
      Gets the source types.
      Returns:
      non-null; the source types
    • getExceptions

      public TypeList getExceptions()
      Gets the list of exception types that might be thrown.
      Returns:
      non-null; the list of exception types
    • getBranchingness

      public int getBranchingness()
      Gets the branchingness of this instance.
      Returns:
      the branchingness
    • isCallLike

      public boolean isCallLike()
      Gets whether this opcode is a function/method call or similar.
      Returns:
      true iff this opcode is call-like
    • isCommutative

      public boolean isCommutative()
      Gets whether this opcode is commutative (the order of its sources are unimportant) or not. All commutative Rops have exactly two sources and have no branchiness.
      Returns:
      true if rop is commutative
    • getNickname

      public String getNickname()
      Gets the nickname. If this instance has no nickname, this returns the result of calling toString().
      Returns:
      non-null; the nickname
    • canThrow

      public final boolean canThrow()
      Gets whether this operation can possibly throw an exception. This is just a convenient wrapper for getExceptions().size() != 0.
      Returns:
      true iff this operation can possibly throw