@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) { return new BuilderInstruction10t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Override protected BuilderInstruction getRealInsn0(LabelAssigner assigner) { if (target == null) { throw new RuntimeException("Cannot jump to a NULL target"); } return new BuilderInstruction10t(opc, assigner.getOrCreateLabel(target)); }
public final void insn_format10t() throws RecognitionException { CommonTree INSTRUCTION_FORMAT10t114=null; Label label_ref115 =null; try { // smaliTreeWalker.g:810:3: ( ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) ) // smaliTreeWalker.g:811:5: ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) { match(input,I_STATEMENT_FORMAT10t,FOLLOW_I_STATEMENT_FORMAT10t_in_insn_format10t2217); match(input, Token.DOWN, null); INSTRUCTION_FORMAT10t114=(CommonTree)match(input,INSTRUCTION_FORMAT10t,FOLLOW_INSTRUCTION_FORMAT10t_in_insn_format10t2219); pushFollow(FOLLOW_label_ref_in_insn_format10t2221); label_ref115=label_ref(); state._fsp--; match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT10t114!=null?INSTRUCTION_FORMAT10t114.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction10t(opcode, label_ref115)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format10t"
@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) { return new BuilderInstruction10t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) { return new BuilderInstruction10t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) { return new BuilderInstruction10t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) { return new BuilderInstruction10t( instruction.getOpcode(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Test public void testFixGotoToGoto16() { MethodImplementationBuilder builder = new MethodImplementationBuilder(1); Label gotoTarget = builder.getLabel("gotoTarget"); builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget)); for (int i=0; i<500; 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(502, instructions.size()); Assert.assertEquals(Opcode.GOTO_16, instructions.get(0).getOpcode()); Assert.assertEquals(502, ((OffsetInstruction)instructions.get(0)).getCodeOffset()); }
@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()); }
public final void insn_format10t() throws RecognitionException { CommonTree INSTRUCTION_FORMAT10t104=null; Label label_ref105 =null; try { // D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:747:3: ( ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) ) // D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:748:5: ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) { match(input,I_STATEMENT_FORMAT10t,FOLLOW_I_STATEMENT_FORMAT10t_in_insn_format10t2026); match(input, Token.DOWN, null); INSTRUCTION_FORMAT10t104=(CommonTree)match(input,INSTRUCTION_FORMAT10t,FOLLOW_INSTRUCTION_FORMAT10t_in_insn_format10t2028); pushFollow(FOLLOW_label_ref_in_insn_format10t2030); label_ref105=label_ref(); state._fsp--; match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT10t104!=null?INSTRUCTION_FORMAT10t104.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction10t(opcode, label_ref105)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format10t"
public final void insn_format10t() throws RecognitionException { CommonTree INSTRUCTION_FORMAT10t114=null; Label label_ref115 =null; try { // smaliTreeWalker.g:810:3: ( ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) ) // smaliTreeWalker.g:811:5: ^( I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref ) { match(input,I_STATEMENT_FORMAT10t,FOLLOW_I_STATEMENT_FORMAT10t_in_insn_format10t2217); match(input, Token.DOWN, null); INSTRUCTION_FORMAT10t114=(CommonTree)match(input,INSTRUCTION_FORMAT10t,FOLLOW_INSTRUCTION_FORMAT10t_in_insn_format10t2219); pushFollow(FOLLOW_label_ref_in_insn_format10t2221); label_ref115=label_ref(); state._fsp--; match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT10t114!=null?INSTRUCTION_FORMAT10t114.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction10t(opcode, label_ref115)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format10t"
builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, firstGotoTarget)); builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, secondGotoTarget));
builder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, gotoTarget));
implBuilder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, implBuilder.getLabel("goto_target")));
implBuilder.addInstruction(new BuilderInstruction10t(Opcode.GOTO, implBuilder.getLabel("goto_target")));