Package com.android.dx.dex.code
Class OutputCollector
java.lang.Object
com.android.dx.dex.code.OutputCollector
Destination for
DalvInsn
instances being output. This class
receives and collects instructions in two pieces — a primary
list and a suffix (generally consisting of adjunct data referred to
by the primary list, such as switch case tables) — which it
merges and emits back out in the form of a DalvInsnList
instance.-
Constructor Summary
ConstructorDescriptionOutputCollector
(DexOptions dexOptions, int initialCapacity, int suffixInitialCapacity, int regCount, int paramSize) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an instruction to the output.void
Adds an instruction to the output suffix.get
(int at) Gets the results of all the calls on this instance, in the form of anOutputFinisher
.void
reverseBranch
(int which, CodeAddress newTarget) Reverses a branch which is buried a given number of instructions backward in the output.int
size()
-
Constructor Details
-
OutputCollector
public OutputCollector(DexOptions dexOptions, int initialCapacity, int suffixInitialCapacity, int regCount, int paramSize) Constructs an instance.- Parameters:
dexOptions
-non-null;
options for dex outputinitialCapacity
->= 0;
initial capacity of the output listsuffixInitialCapacity
->= 0;
initial capacity of the output suffixregCount
->= 0;
register count for the methodparamSize
- size, in register units, of all the parameters for this method
-
-
Method Details
-
add
Adds an instruction to the output.- Parameters:
insn
-non-null;
the instruction to add
-
get
-
size
public int size() -
reverseBranch
Reverses a branch which is buried a given number of instructions backward in the output. It is illegal to call this unless the indicated instruction really is a reversible branch.- Parameters:
which
- how many instructions back to find the branch;0
is the most recently added instruction,1
is the instruction before that, etc.newTarget
-non-null;
the new target for the reversed branch
-
addSuffix
Adds an instruction to the output suffix.- Parameters:
insn
-non-null;
the instruction to add
-
getFinisher
Gets the results of all the calls on this instance, in the form of anOutputFinisher
.- Returns:
non-null;
the output finisher- Throws:
UnsupportedOperationException
- if this method has already been called
-