com.android.dx.dex.code
Class OutputCollector

java.lang.Object
  extended by com.android.dx.dex.code.OutputCollector

public final class OutputCollector
extends Object

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
OutputCollector(DexOptions dexOptions, int initialCapacity, int suffixInitialCapacity, int regCount)
          Constructs an instance.
 
Method Summary
 void add(DalvInsn insn)
          Adds an instruction to the output.
 void addSuffix(DalvInsn insn)
          Adds an instruction to the output suffix.
 OutputFinisher getFinisher()
          Gets the results of all the calls on this instance, in the form of an OutputFinisher.
 void reverseBranch(int which, CodeAddress newTarget)
          Reverses a branch which is buried a given number of instructions backward in the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputCollector

public OutputCollector(DexOptions dexOptions,
                       int initialCapacity,
                       int suffixInitialCapacity,
                       int regCount)
Constructs an instance.

Parameters:
dexOptions - non-null; options for dex output
initialCapacity - >= 0; initial capacity of the output list
suffixInitialCapacity - >= 0; initial capacity of the output suffix
regCount - >= 0; register count for the method
Method Detail

add

public void add(DalvInsn insn)
Adds an instruction to the output.

Parameters:
insn - non-null; the instruction to add

reverseBranch

public void reverseBranch(int which,
                          CodeAddress newTarget)
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

public void addSuffix(DalvInsn insn)
Adds an instruction to the output suffix.

Parameters:
insn - non-null; the instruction to add

getFinisher

public OutputFinisher getFinisher()
Gets the results of all the calls on this instance, in the form of an OutputFinisher.

Returns:
non-null; the output finisher
Throws:
UnsupportedOperationException - if this method has already been called


Copyright © 2013. All Rights Reserved.