OutputCollectorpublic final class OutputCollector extends Object Destination for {@link 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 {@link DalvInsnList}
instance. |
Fields Summary |
---|
private final OutputFinisher | finisher{@code non-null;} the associated finisher (which holds the instruction
list in-progress) | private ArrayList | suffix{@code null-ok;} suffix for the output, or {@code null} if the suffix
has been appended to the main output (by {@link #appendSuffixToOutput}) |
Constructors Summary |
---|
public OutputCollector(com.android.dx.dex.DexOptions dexOptions, int initialCapacity, int suffixInitialCapacity, int regCount, int paramSize)Constructs an instance.
this.finisher = new OutputFinisher(dexOptions, initialCapacity, regCount, paramSize);
this.suffix = new ArrayList<DalvInsn>(suffixInitialCapacity);
|
Methods Summary |
---|
public void | add(DalvInsn insn)Adds an instruction to the output.
finisher.add(insn);
| public void | addSuffix(DalvInsn insn)Adds an instruction to the output suffix.
suffix.add(insn);
| private void | appendSuffixToOutput()Helper for {@link #getFinisher}, which appends the suffix to
the primary output.
int size = suffix.size();
for (int i = 0; i < size; i++) {
finisher.add(suffix.get(i));
}
suffix = null;
| public OutputFinisher | getFinisher()Gets the results of all the calls on this instance, in the form of
an {@link OutputFinisher}.
if (suffix == null) {
throw new UnsupportedOperationException("already processed");
}
appendSuffixToOutput();
return finisher;
| 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.
finisher.reverseBranch(which, newTarget);
|
|