Class Insn
java.lang.Object
com.android.dx.rop.code.Insn
- All Implemented Interfaces:
ToHuman
- Direct Known Subclasses:
CstInsn, FillArrayDataInsn, InvokePolymorphicInsn, PlainInsn, SwitchInsn, ThrowingInsn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBase implementation ofInsn.Visitor, which has empty method bodies for all methods.static interfaceVisitor interface for this (outer) class. -
Constructor Summary
ConstructorsConstructorDescriptionInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaccept(Insn.Visitor visitor) Calls the appropriate method on the given visitor, depending on the class of this instance.final booleancanThrow()Gets whether this instruction can possibly throw an exception.booleanCompares Insn contents, sinceInsn.equals()is defined to be an identity compare.copy()Returns an exact copy of this Insnfinal booleanInstances of this class compare by identity.abstract TypeListGets the list of possibly-caught exceptions.Gets an "inline" string portion for toHuman(), if available.final RegisterSpecGets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs.final RopGets the opcode.final SourcePositionGets the source position.final RegisterSpecGets the result spec, if any.final RegisterSpecListGets the source specs.final inthashCode()This implementation returns the identity hashcode of this instance.toHuman()Gets a human-oriented (and slightly lossy) string for this instance.protected final StringtoHumanWithInline(String extra) Returns the human string form of this instance, with the given bit added in the standard location for an inline argument.toString()protected final StringtoStringWithInline(String extra) Returns the string form of this instance, with the given bit added in the standard location for an inline argument.abstract InsnwithAddedCatch(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.abstract InsnwithNewRegisters(RegisterSpec result, RegisterSpecList sources) Returns an instance that is just like this one, except with new result and source registers.abstract InsnwithRegisterOffset(int delta) Returns an instance that is just like this one, except that all register references have been offset by the given delta.Returns an instance that is just like this one, except that, if possible, the insn is converted into a version in which a source (if it is a constant) is represented directly rather than as a register reference.
-
Constructor Details
-
Insn
Constructs an instance.- Parameters:
opcode-non-null;the opcodeposition-non-null;source positionresult-null-ok;spec for the result, if anysources-non-null;specs for all the sources
-
-
Method Details
-
equals
-
hashCode
public final int hashCode()This implementation returns the identity hashcode of this instance. This is proper, since instances of this class compare by identity (seeequals(Object)). -
toString
-
toHuman
-
getInlineString
Gets an "inline" string portion for toHuman(), if available. This is the portion that appears after the Rop opcode- Returns:
null-ok;if non-null, the inline text for toHuman()
-
getOpcode
-
getPosition
Gets the source position.- Returns:
non-null;the source position
-
getResult
Gets the result spec, if any. A return value ofnullmeans this instruction returns nothing.- Returns:
null-ok;the result spec, if any
-
getLocalAssignment
Gets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs. This may be the result register, or formark-localinsns it may be the source.- Returns:
null-ok;a named register spec or null
-
getSources
Gets the source specs.- Returns:
non-null;the source specs
-
canThrow
public final boolean canThrow()Gets whether this instruction can possibly throw an exception. This is just a convenient wrapper forgetOpcode().canThrow().- Returns:
trueiff this instruction can possibly throw
-
getCatches
Gets the list of possibly-caught exceptions. This returnsStdTypeList.EMPTYif 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, usecanThrow().- Returns:
non-null;the catches list
-
accept
Calls the appropriate method on the given visitor, depending on the class of this instance. Subclasses must override this.- Parameters:
visitor-non-null;the visitor to call on
-
withAddedCatch
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, usecanThrow().- Parameters:
type-non-null;type to append to the catch list- Returns:
non-null;an appropriately-constructed instance
-
withRegisterOffset
Returns an instance that is just like this one, except that all register references have been offset by the given delta.- Parameters:
delta- the amount to offset register references by- Returns:
non-null;an appropriately-constructed instance
-
withSourceLiteral
Returns an instance that is just like this one, except that, if possible, the insn is converted into a version in which a source (if it is a constant) is represented directly rather than as a register reference.thisis returned in cases where the translation is not possible.- Returns:
non-null;an appropriately-constructed instance
-
copy
Returns an exact copy of this Insn- Returns:
non-null;an appropriately-constructed instance
-
contentEquals
Compares Insn contents, sinceInsn.equals()is defined to be an identity compare. Insn's arecontentEquals()if they have the same opcode, registers, source position, and other metadata.- Returns:
- true in the case described above
-
withNewRegisters
Returns an instance that is just like this one, except with new result and source registers.- Parameters:
result-null-ok;new result registersources-non-null;new sources registers- Returns:
non-null;an appropriately-constructed instance
-
toStringWithInline
-
toHumanWithInline
-