continue;
// If the last instruction in the block
// is a jump, leave room for the instruction,
// but don't emit it yet.
Instruction last = b.get(b.size() - 1);
if (last.isBranch())
{
if (last.getOpcode() == OP_lookupswitch)
{
// Switch table contains a U30 case count and S24 offsets.
int switch_size = 1 + sizeOfU30(last.getOperandCount()) + SIZEOF_S24 * last.getOperandCount();
code_len += switch_size;
}
else
{
assert (null != last.getTarget());
// Reserve space for a branch instruction.
code_len += 4;
}
}
}
// Note: Can't compute code_start until we've seen
// how big this U30 is.
result.writeU30(code_len);
int code_start = result.size();
// Now we can resolve labels to their code offsets.
// Copy the linear code sequences into the main ABCWriter,
// and emit the branch and lookupswitch instructions.
for (IBasicBlock b : f.getCfg().getBlocksInEntryOrder())
{
writers.get(b).writeTo(result);
if (b.size() > 0)
{
Instruction last = b.get(b.size() - 1);
if (last.isBranch())
{
if (OP_lookupswitch == last.getOpcode())
{
emitLookupswitch(result, code_start, f, last, block_offsets);
}
else
{
assert (last.getTarget() != null);
emitBranch(result, last.getOpcode(), f.getBlock(last.getTarget(), !allowBadJumps), code_start, block_offsets, code_len);
}
}
}
}