use of org.jf.dexlib2.builder.instruction.BuilderInstruction10t in project smali by JesusFreke.
the class FixGotoTest method testFixGotoToGoto32.
@Test
public void testFixGotoToGoto32() {
MethodImplementationBuilder builder = new MethodImplementationBuilder(1);
Label gotoTarget = builder.getLabel("gotoTarget");
builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget));
for (int i = 0; i < 70000; i++) {
builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
}
builder.addLabel("gotoTarget");
builder.addInstruction(new BuilderInstruction10x(Opcode.RETURN_VOID));
MethodImplementation impl = builder.getMethodImplementation();
List<? extends Instruction> instructions = Lists.newArrayList(impl.getInstructions());
Assert.assertEquals(70002, instructions.size());
Assert.assertEquals(Opcode.GOTO_32, instructions.get(0).getOpcode());
Assert.assertEquals(70003, ((OffsetInstruction) instructions.get(0)).getCodeOffset());
}
Aggregations