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

public final Class DexTranslationAdvice

extends Object
implements TranslationAdvice
Class Inheritance
All Implemented Interfaces
org.droidparts.dexmaker.dx.rop.code.TranslationAdvice
Imports
org.droidparts.dexmaker.dx.rop.cst.CstInteger, org.droidparts.dexmaker.dx.rop.type.Type

Implementation of TranslationAdvice which represents what the dex format will be able to represent.

Field Summary

Modifier and TypeField and Description
private final boolean
disableSourcesInOrder

when true: always returns false for requiresSourcesInOrder

private static final int
MIN_INVOKE_IN_ORDER

The minimum source width, in register units, for an invoke instruction that requires its sources to be in order and contiguous.

public static final DexTranslationAdvice
NO_SOURCES_IN_ORDER

debug advice for disabling invoke-range optimization

public static final DexTranslationAdvice
THE_ONE

non-null; standard instance of this class

Constructor Summary

AccessConstructor and Description
private
DexTranslationAdvice()

This class is not publicly instantiable.

private
DexTranslationAdvice(boolean disableInvokeRange)

Method Summary

Modifier and TypeMethod and Description
public int
getMaxOptimalRegisterCount()

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.getMaxOptimalRegisterCount.

Gets the maximum register width that can be represented optimally.
public boolean
hasConstantOperation(Rop
non-null; the opcode
opcode
,
RegisterSpec
non-null; the first source
sourceA
,
RegisterSpec
non-null; the second source
sourceB
)

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.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.
public boolean
requiresSourcesInOrder(Rop
non-null; opcode
opcode
,
RegisterSpecList
non-null; source list
sources
)

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.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)
private int

Returns:

>= 0; rop-form width in register units
totalRopWidth
(RegisterSpecList
non-null; list of SSA registers
sources
)

Calculates the total rop width of the list of SSA registers

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

disableSourcesInOrderback to summary
private final boolean disableSourcesInOrder

when true: always returns false for requiresSourcesInOrder

MIN_INVOKE_IN_ORDERback to summary
private static final int MIN_INVOKE_IN_ORDER

The minimum source width, in register units, for an invoke instruction that requires its sources to be in order and contiguous.

NO_SOURCES_IN_ORDERback to summary
public static final DexTranslationAdvice NO_SOURCES_IN_ORDER

debug advice for disabling invoke-range optimization

THE_ONEback to summary
public static final DexTranslationAdvice THE_ONE

non-null; standard instance of this class

Constructor Detail

DexTranslationAdviceback to summary
private DexTranslationAdvice()

This class is not publicly instantiable. Use THE_ONE.

DexTranslationAdviceback to summary
private DexTranslationAdvice(boolean disableInvokeRange)

Method Detail

getMaxOptimalRegisterCountback to summary
public int getMaxOptimalRegisterCount()

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.getMaxOptimalRegisterCount.

Doc from org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.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.

Returns:int

register count noted above

hasConstantOperationback to summary
public boolean hasConstantOperation(Rop opcode, RegisterSpec sourceA, RegisterSpec sourceB)

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.hasConstantOperation.

Doc from org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.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.

Parameters
opcode:Rop

non-null; the opcode

sourceA:RegisterSpec

non-null; the first source

sourceB:RegisterSpec

non-null; the second source

Returns:boolean

true iff the target can represent the operation using a constant for the last argument

requiresSourcesInOrderback to summary
public boolean requiresSourcesInOrder(Rop opcode, RegisterSpecList sources)

Implements org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.requiresSourcesInOrder.

Doc from org.droidparts.dexmaker.dx.rop.code.TranslationAdvice.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)

Parameters
opcode:Rop

non-null; opcode

sources:RegisterSpecList

non-null; source list

Returns:boolean

true iff the target requires the sources to be in order and contiguous.

totalRopWidthback to summary
private int totalRopWidth(RegisterSpecList sources)

Calculates the total rop width of the list of SSA registers

Parameters
sources:RegisterSpecList

non-null; list of SSA registers

Returns:int

>= 0; rop-form width in register units