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

public final Class OutputCollector

extends Object
Class Inheritance
Imports
org.droidparts.dexmaker.dx.dex.DexOptions, java.util.ArrayList

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.

Field Summary

Modifier and TypeField and Description
private final OutputFinisher
finisher

non-null; the associated finisher (which holds the instruction list in-progress)

private ArrayList<DalvInsn>
suffix

null-ok; suffix for the output, or null if the suffix has been appended to the main output (by appendSuffixToOutput)

Constructor Summary

AccessConstructor and Description
public
OutputCollector(DexOptions
non-null; options for dex output
dexOptions
,
int
>= 0; initial capacity of the output list
initialCapacity
,
int
>= 0; initial capacity of the output suffix
suffixInitialCapacity
,
int
>= 0; register count for the method
regCount
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public void
add(DalvInsn
non-null; the instruction to add
insn
)

Adds an instruction to the output.

public void
addSuffix(DalvInsn
non-null; the instruction to add
insn
)

Adds an instruction to the output suffix.

private void
appendSuffixToOutput()

Helper for getFinisher, which appends the suffix to the primary output.

public OutputFinisher

Returns:

non-null; the output finisher
getFinisher
()

Gets the results of all the calls on this instance, in the form of an OutputFinisher.

public void
reverseBranch(int
how many instructions back to find the branch; 0 is the most recently added instruction, 1 is the instruction before that, etc.
which
,
CodeAddress
non-null; the new target for the reversed branch
newTarget
)

Reverses a branch which is buried a given number of instructions backward in the output.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

finisherback to summary
private final OutputFinisher finisher

non-null; the associated finisher (which holds the instruction list in-progress)

suffixback to summary
private ArrayList<DalvInsn> suffix

null-ok; suffix for the output, or null if the suffix has been appended to the main output (by appendSuffixToOutput)

Constructor Detail

OutputCollectorback to summary
public OutputCollector(DexOptions dexOptions, int initialCapacity, int suffixInitialCapacity, int regCount)

Constructs an instance.

Parameters
dexOptions:DexOptions

non-null; options for dex output

initialCapacity:int

>= 0; initial capacity of the output list

suffixInitialCapacity:int

>= 0; initial capacity of the output suffix

regCount:int

>= 0; register count for the method

Method Detail

addback to summary
public void add(DalvInsn insn)

Adds an instruction to the output.

Parameters
insn:DalvInsn

non-null; the instruction to add

addSuffixback to summary
public void addSuffix(DalvInsn insn)

Adds an instruction to the output suffix.

Parameters
insn:DalvInsn

non-null; the instruction to add

appendSuffixToOutputback to summary
private void appendSuffixToOutput()

Helper for getFinisher, which appends the suffix to the primary output.

getFinisherback to summary
public OutputFinisher getFinisher()

Gets the results of all the calls on this instance, in the form of an OutputFinisher.

Returns:OutputFinisher

non-null; the output finisher

Exceptions
UnsupportedOperationException:
if this method has already been called
reverseBranchback to summary
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:int

how many instructions back to find the branch; 0 is the most recently added instruction, 1 is the instruction before that, etc.

newTarget:CodeAddress

non-null; the new target for the reversed branch