com.android.dx.rop.code
Class ConservativeTranslationAdvice

java.lang.Object
  extended by com.android.dx.rop.code.ConservativeTranslationAdvice
All Implemented Interfaces:
TranslationAdvice

public final class ConservativeTranslationAdvice
extends Object
implements TranslationAdvice

Implementation of TranslationAdvice which conservatively answers false to all methods.


Field Summary
static ConservativeTranslationAdvice THE_ONE
          non-null; standard instance of this class
 
Method Summary
 int getMaxOptimalRegisterCount()
          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)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THE_ONE

public static final ConservativeTranslationAdvice THE_ONE
non-null; standard instance of this class

Method Detail

hasConstantOperation

public 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. (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 interface TranslationAdvice
Parameters:
opcode - non-null; the opcode
sourceA - non-null; the first source
sourceB - non-null; the second source
Returns:
true iff the target can represent the operation using a constant for the last argument

requiresSourcesInOrder

public 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)

Specified by:
requiresSourcesInOrder in interface TranslationAdvice
Parameters:
opcode - non-null; opcode
sources - 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 interface TranslationAdvice
Returns:
register count noted above


Copyright © 2015. All rights reserved.