Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.rop.code

public final Class Rop

extends Object
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.type.StdTypeList, .Type, .TypeList, org.droidparts.dexmaker.dx.util.Hex

Class that describes all the immutable parts of register-based operations.

Field Summary

Modifier and TypeField and Description
public static final int
BRANCH_GOTO

indicates an unconditional goto

public static final int
BRANCH_IF

indicates a two-way branch

public static final int
BRANCH_MAX

maximum BRANCH_* value

public static final int
BRANCH_MIN

minimum BRANCH_* value

public static final int
BRANCH_NONE

indicates a non-branching op

public static final int
BRANCH_RETURN

indicates a function/method return

public static final int
BRANCH_SWITCH

indicates a switch-style branch

public static final int
BRANCH_THROW

indicates a throw-style branch (both always-throws and may-throw)

private final int
branchingness

the branchingness of this op; one of the BRANCH_* constants in this class

private final TypeList
exceptions

non-null; list of possible types thrown by this operation

private final boolean
isCallLike

whether this is a function/method call op or similar

private final String
nickname

null-ok; nickname, if specified (used for debugging)

private final int
opcode

the opcode; one of the constants in RegOps

private final Type
result

non-null; result type of this operation; Type#VOID for no-result operations

private final TypeList
sources

non-null; types of all the sources of this operation

Constructor Summary

AccessConstructor and Description
public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
Type
non-null; result type of this operation; Type#VOID for no-result operations
result
,
TypeList
non-null; types of all the sources of this operation
sources
,
TypeList
non-null; list of possible types thrown by this operation
exceptions
,
int
the branchingness of this op; one of the BRANCH_* constants
branchingness
,
boolean
whether the op is a function/method call or similar
isCallLike
,
String
null-ok; optional nickname (used for debugging)
nickname
)

Constructs an instance.

public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
Type
non-null; result type of this operation; Type#VOID for no-result operations
result
,
TypeList
non-null; types of all the sources of this operation
sources
,
TypeList
non-null; list of possible types thrown by this operation
exceptions
,
int
the branchingness of this op; one of the BRANCH_* constants
branchingness
,
String
null-ok; optional nickname (used for debugging)
nickname
)

Constructs an instance.

public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
Type
non-null; result type of this operation; Type#VOID for no-result operations
result
,
TypeList
non-null; types of all the sources of this operation
sources
,
int
the branchingness of this op; one of the BRANCH_* constants
branchingness
,
String
null-ok; optional nickname (used for debugging)
nickname
)

Constructs a no-exception instance.

public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
Type
non-null; result type of this operation; Type#VOID for no-result operations
result
,
TypeList
non-null; types of all the sources of this operation
sources
,
String
null-ok; optional nickname (used for debugging)
nickname
)

Constructs a non-branching no-exception instance.

public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
Type
non-null; result type of this operation; Type#VOID for no-result operations
result
,
TypeList
non-null; types of all the sources of this operation
sources
,
TypeList
non-null; list of possible types thrown by this operation
exceptions
,
String
null-ok; optional nickname (used for debugging)
nickname
)

Constructs a non-empty exceptions instance.

public
Rop(int
the opcode; one of the constants in RegOps
opcode
,
TypeList
non-null; types of all the sources of this operation
sources
,
TypeList
non-null; list of possible types thrown by this operation
exceptions
)

Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (see isCallLike).

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true iff this operation can possibly throw
canThrow
()

Gets whether this operation can possibly throw an exception.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int

Returns:

the branchingness
getBranchingness
()

Gets the branchingness of this instance.

public TypeList

Returns:

non-null; the list of exception types
getExceptions
()

Gets the list of exception types that might be thrown.

public String

Returns:

non-null; the nickname
getNickname
()

Gets the nickname.

public int

Returns:

the opcode
getOpcode
()

Gets the opcode.

public Type

Returns:

null-ok; the result spec
getResult
()

Gets the result type.

public TypeList

Returns:

non-null; the source types
getSources
()

Gets the source types.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean

Returns:

true iff this opcode is call-like
isCallLike
()

Gets whether this opcode is a function/method call or similar.

public boolean

Returns:

true if rop is commutative
isCommutative
()

Gets whether this opcode is commutative (the order of its sources are unimportant) or not.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

BRANCH_GOTOback to summary
public static final int BRANCH_GOTO

indicates an unconditional goto

BRANCH_IFback to summary
public static final int BRANCH_IF

indicates a two-way branch

BRANCH_MAXback to summary
public static final int BRANCH_MAX

maximum BRANCH_* value

BRANCH_MINback to summary
public static final int BRANCH_MIN

minimum BRANCH_* value

BRANCH_NONEback to summary
public static final int BRANCH_NONE

indicates a non-branching op

BRANCH_RETURNback to summary
public static final int BRANCH_RETURN

indicates a function/method return

BRANCH_SWITCHback to summary
public static final int BRANCH_SWITCH

indicates a switch-style branch

BRANCH_THROWback to summary
public static final int BRANCH_THROW

indicates a throw-style branch (both always-throws and may-throw)

branchingnessback to summary
private final int branchingness

the branchingness of this op; one of the BRANCH_* constants in this class

exceptionsback to summary
private final TypeList exceptions

non-null; list of possible types thrown by this operation

isCallLikeback to summary
private final boolean isCallLike

whether this is a function/method call op or similar

nicknameback to summary
private final String nickname

null-ok; nickname, if specified (used for debugging)

opcodeback to summary
private final int opcode

the opcode; one of the constants in RegOps

resultback to summary
private final Type result

non-null; result type of this operation; Type#VOID for no-result operations

sourcesback to summary
private final TypeList sources

non-null; types of all the sources of this operation

Constructor Detail

Ropback to summary
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:int

the opcode; one of the constants in RegOps

result:Type

non-null; result type of this operation; Type#VOID for no-result operations

sources:TypeList

non-null; types of all the sources of this operation

exceptions:TypeList

non-null; list of possible types thrown by this operation

branchingness:int

the branchingness of this op; one of the BRANCH_* constants

isCallLike:boolean

whether the op is a function/method call or similar

nickname:String

null-ok; optional nickname (used for debugging)

Ropback to summary
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:int

the opcode; one of the constants in RegOps

result:Type

non-null; result type of this operation; Type#VOID for no-result operations

sources:TypeList

non-null; types of all the sources of this operation

exceptions:TypeList

non-null; list of possible types thrown by this operation

branchingness:int

the branchingness of this op; one of the BRANCH_* constants

nickname:String

null-ok; optional nickname (used for debugging)

Ropback to summary
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:int

the opcode; one of the constants in RegOps

result:Type

non-null; result type of this operation; Type#VOID for no-result operations

sources:TypeList

non-null; types of all the sources of this operation

branchingness:int

the branchingness of this op; one of the BRANCH_* constants

nickname:String

null-ok; optional nickname (used for debugging)

Ropback to summary
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:int

the opcode; one of the constants in RegOps

result:Type

non-null; result type of this operation; Type#VOID for no-result operations

sources:TypeList

non-null; types of all the sources of this operation

nickname:String

null-ok; optional nickname (used for debugging)

Ropback to summary
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:int

the opcode; one of the constants in RegOps

result:Type

non-null; result type of this operation; Type#VOID for no-result operations

sources:TypeList

non-null; types of all the sources of this operation

exceptions:TypeList

non-null; list of possible types thrown by this operation

nickname:String

null-ok; optional nickname (used for debugging)

Ropback to summary
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:int

the opcode; one of the constants in RegOps

sources:TypeList

non-null; types of all the sources of this operation

exceptions:TypeList

non-null; list of possible types thrown by this operation

Method Detail

canThrowback to summary
public final boolean canThrow()

Gets whether this operation can possibly throw an exception. This is just a convenient wrapper for getExceptions().size() != 0.

Returns:boolean

true iff this operation can possibly throw

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBranchingnessback to summary
public int getBranchingness()

Gets the branchingness of this instance.

Returns:int

the branchingness

getExceptionsback to summary
public TypeList getExceptions()

Gets the list of exception types that might be thrown.

Returns:TypeList

non-null; the list of exception types

getNicknameback to summary
public String getNickname()

Gets the nickname. If this instance has no nickname, this returns the result of calling toString.

Returns:String

non-null; the nickname

getOpcodeback to summary
public int getOpcode()

Gets the opcode.

Returns:int

the opcode

getResultback to summary
public Type getResult()

Gets the result type. A return value of Type#VOID means this operation returns nothing.

Returns:Type

null-ok; the result spec

getSourcesback to summary
public TypeList getSources()

Gets the source types.

Returns:TypeList

non-null; the source types

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isCallLikeback to summary
public boolean isCallLike()

Gets whether this opcode is a function/method call or similar.

Returns:boolean

true iff this opcode is call-like

isCommutativeback to summary
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:boolean

true if rop is commutative

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override