Package com.android.dx.rop.code
Class Rop
java.lang.Object
com.android.dx.rop.code.Rop
Class that describes all the immutable parts of register-based operations.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
indicates an unconditional gotostatic final int
indicates a two-way branchstatic final int
maximumBRANCH_*
valuestatic final int
minimumBRANCH_*
valuestatic final int
indicates a non-branching opstatic final int
indicates a function/method returnstatic final int
indicates a switch-style branchstatic final int
indicates a throw-style branch (both always-throws and may-throw) -
Constructor Summary
ConstructorDescriptionConstructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (seeisCallLike
).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.Constructs a non-empty exceptions instance.Constructs a non-branching no-exception instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
canThrow()
Gets whether this operation can possibly throw an exception.boolean
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
hashCode()
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.toString()
-
Field Details
-
BRANCH_MIN
public static final int BRANCH_MINminimumBRANCH_*
value- See Also:
-
BRANCH_NONE
public static final int BRANCH_NONEindicates a non-branching op- See Also:
-
BRANCH_RETURN
public static final int BRANCH_RETURNindicates a function/method return- See Also:
-
BRANCH_GOTO
public static final int BRANCH_GOTOindicates an unconditional goto- See Also:
-
BRANCH_IF
public static final int BRANCH_IFindicates a two-way branch- See Also:
-
BRANCH_SWITCH
public static final int BRANCH_SWITCHindicates a switch-style branch- See Also:
-
BRANCH_THROW
public static final int BRANCH_THROWindicates a throw-style branch (both always-throws and may-throw)- See Also:
-
BRANCH_MAX
public static final int BRANCH_MAXmaximumBRANCH_*
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 inRegOps
result
-non-null;
result type of this operation;Type.VOID
for no-result operationssources
-non-null;
types of all the sources of this operationexceptions
-non-null;
list of possible types thrown by this operationbranchingness
- the branchingness of this op; one of theBRANCH_*
constantsisCallLike
- whether the op is a function/method call or similarnickname
-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 (seeisCallLike
).- Parameters:
opcode
- the opcode; one of the constants inRegOps
result
-non-null;
result type of this operation;Type.VOID
for no-result operationssources
-non-null;
types of all the sources of this operationexceptions
-non-null;
list of possible types thrown by this operationbranchingness
- the branchingness of this op; one of theBRANCH_*
constantsnickname
-null-ok;
optional nickname (used for debugging)
-
Rop
Constructs a no-exception instance. The constructed instance is never a call-like op (seeisCallLike
).- Parameters:
opcode
- the opcode; one of the constants inRegOps
result
-non-null;
result type of this operation;Type.VOID
for no-result operationssources
-non-null;
types of all the sources of this operationbranchingness
- the branchingness of this op; one of theBRANCH_*
constantsnickname
-null-ok;
optional nickname (used for debugging)
-
Rop
Constructs a non-branching no-exception instance. Thebranchingness
is alwaysBRANCH_NONE
, and it is never a call-like op (seeisCallLike
). -
Rop
Constructs a non-empty exceptions instance. Itsbranchingness
is alwaysBRANCH_THROW
, but it is never a call-like op (seeisCallLike
).- Parameters:
opcode
- the opcode; one of the constants inRegOps
result
-non-null;
result type of this operation;Type.VOID
for no-result operationssources
-non-null;
types of all the sources of this operationexceptions
-non-null;
list of possible types thrown by this operationnickname
-null-ok;
optional nickname (used for debugging)
-
Rop
Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (seeisCallLike
). Itsbranchingness
is alwaysBRANCH_THROW
.- Parameters:
opcode
- the opcode; one of the constants inRegOps
sources
-non-null;
types of all the sources of this operationexceptions
-non-null;
list of possible types thrown by this operation
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
toString
-
getOpcode
public int getOpcode()Gets the opcode.- Returns:
- the opcode
-
getResult
Gets the result type. A return value ofType.VOID
means this operation returns nothing.- Returns:
null-ok;
the result spec
-
getSources
Gets the source types.- Returns:
non-null;
the source types
-
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
Gets the nickname. If this instance has no nickname, this returns the result of callingtoString()
.- 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 forgetExceptions().size() != 0
.- Returns:
true
iff this operation can possibly throw
-