Package com.android.dx.rop.code
Class DexTranslationAdvice
java.lang.Object
com.android.dx.rop.code.DexTranslationAdvice
- All Implemented Interfaces:
TranslationAdvice
Implementation of
TranslationAdvice
which represents what
the dex format will be able to represent.-
Field Summary
Modifier and TypeFieldDescriptionstatic final DexTranslationAdvice
debug advice for disabling invoke-range optimizationstatic final DexTranslationAdvice
non-null;
standard instance of this class -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the maximum register width that can be represented optimally.boolean
hasConstantOperation
(Rop opcode, RegisterSpec sourceA, RegisterSpec sourceB) Returns an indication of whether the target can directly represent an instruction with the given opcode operating on the given arguments, where the last source argument is used as a constant.boolean
requiresSourcesInOrder
(Rop opcode, RegisterSpecList sources) Returns true if the translation target requires the sources of the specified opcode to be in order and contiguous (eg, for an invoke-range)
-
Field Details
-
THE_ONE
non-null;
standard instance of this class -
NO_SOURCES_IN_ORDER
debug advice for disabling invoke-range optimization
-
-
Method Details
-
hasConstantOperation
Returns an indication of whether the target can directly represent an instruction with the given opcode operating on the given arguments, where the last source argument is used as a constant. (That is, the last argument must have a type which indicates it is a known constant.) The instruction associated must have exactly two sources.- Specified by:
hasConstantOperation
in interfaceTranslationAdvice
- Parameters:
opcode
-non-null;
the opcodesourceA
-non-null;
the first sourcesourceB
-non-null;
the second source- Returns:
true
iff the target can represent the operation using a constant for the last argument
-
requiresSourcesInOrder
Returns true if the translation target requires the sources of the specified opcode to be in order and contiguous (eg, for an invoke-range)- Specified by:
requiresSourcesInOrder
in interfaceTranslationAdvice
- Parameters:
opcode
-non-null;
opcodesources
-non-null;
source list- Returns:
true
iff the target requires the sources to be in order and contiguous.
-
getMaxOptimalRegisterCount
public int getMaxOptimalRegisterCount()Gets the maximum register width that can be represented optimally. For example, Dex bytecode does not have instruction forms that take register numbers larger than 15 for all instructions so DexTranslationAdvice returns 15 here.- Specified by:
getMaxOptimalRegisterCount
in interfaceTranslationAdvice
- Returns:
- register count noted above
-