@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Override protected BuilderInstruction getRealInsn0(LabelAssigner assigner) { return new BuilderInstruction32x(opc, getRegA().getNumber(), getRegB().getNumber()); }
int instanceRegister = registers.get(0); BuilderInstruction move = new BuilderInstruction32x(Opcode.MOVE_OBJECT_16, instanceRegister, targetRegister); instructions.add(move);
public final void insn_format32x() throws RecognitionException { CommonTree registerA=null; CommonTree registerB=null; CommonTree INSTRUCTION_FORMAT32x174=null; try { // smaliTreeWalker.g:1118:3: ( ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) ) // smaliTreeWalker.g:1119:5: ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) { match(input,I_STATEMENT_FORMAT32x,FOLLOW_I_STATEMENT_FORMAT32x_in_insn_format32x3058); match(input, Token.DOWN, null); INSTRUCTION_FORMAT32x174=(CommonTree)match(input,INSTRUCTION_FORMAT32x,FOLLOW_INSTRUCTION_FORMAT32x_in_insn_format32x3060); registerA=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x3064); registerB=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x3068); match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT32x174!=null?INSTRUCTION_FORMAT32x174.getText():null)); int regA = parseRegister_short((registerA!=null?registerA.getText():null)); int regB = parseRegister_short((registerB!=null?registerB.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction32x(opcode, regA, regB)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format32x"
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) { return new BuilderInstruction32x( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB()); }
public final void insn_format32x() throws RecognitionException { CommonTree registerA=null; CommonTree registerB=null; CommonTree INSTRUCTION_FORMAT32x174=null; try { // smaliTreeWalker.g:1118:3: ( ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) ) // smaliTreeWalker.g:1119:5: ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) { match(input,I_STATEMENT_FORMAT32x,FOLLOW_I_STATEMENT_FORMAT32x_in_insn_format32x3058); match(input, Token.DOWN, null); INSTRUCTION_FORMAT32x174=(CommonTree)match(input,INSTRUCTION_FORMAT32x,FOLLOW_INSTRUCTION_FORMAT32x_in_insn_format32x3060); registerA=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x3064); registerB=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x3068); match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT32x174!=null?INSTRUCTION_FORMAT32x174.getText():null)); int regA = parseRegister_short((registerA!=null?registerA.getText():null)); int regB = parseRegister_short((registerB!=null?registerB.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction32x(opcode, regA, regB)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format32x"
public final void insn_format32x() throws RecognitionException { CommonTree registerA=null; CommonTree registerB=null; CommonTree INSTRUCTION_FORMAT32x160=null; try { // D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1029:3: ( ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) ) // D:\\decomplier_tools\\smali\\smali\\smali\\src\\main\\antlr3\\smaliTreeWalker.g:1030:5: ^( I_STATEMENT_FORMAT32x INSTRUCTION_FORMAT32x registerA= REGISTER registerB= REGISTER ) { match(input,I_STATEMENT_FORMAT32x,FOLLOW_I_STATEMENT_FORMAT32x_in_insn_format32x2801); match(input, Token.DOWN, null); INSTRUCTION_FORMAT32x160=(CommonTree)match(input,INSTRUCTION_FORMAT32x,FOLLOW_INSTRUCTION_FORMAT32x_in_insn_format32x2803); registerA=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x2807); registerB=(CommonTree)match(input,REGISTER,FOLLOW_REGISTER_in_insn_format32x2811); match(input, Token.UP, null); Opcode opcode = opcodes.getOpcodeByName((INSTRUCTION_FORMAT32x160!=null?INSTRUCTION_FORMAT32x160.getText():null)); int regA = parseRegister_short((registerA!=null?registerA.getText():null)); int regB = parseRegister_short((registerB!=null?registerB.getText():null)); method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction32x(opcode, regA, regB)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "insn_format32x"
@Test public void testNewLabelByAddress() { MethodImplementationBuilder builder = new MethodImplementationBuilder(10); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0)); MutableMethodImplementation mutableMethodImplementation = new MutableMethodImplementation(builder.getMethodImplementation()); mutableMethodImplementation.addCatch( mutableMethodImplementation.newLabelForAddress(0), mutableMethodImplementation.newLabelForAddress(8), mutableMethodImplementation.newLabelForAddress(1)); Assert.assertEquals(0, mutableMethodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, mutableMethodImplementation.getTryBlocks().get(0).getCodeUnitCount()); Assert.assertEquals(1, mutableMethodImplementation.getTryBlocks().get(0).getExceptionHandlers().get(0) .getHandlerCodeAddress()); }
@Test public void testTryEndAtEndOfMethod() { MethodImplementationBuilder builder = new MethodImplementationBuilder(10); Label startLabel = builder.addLabel("start"); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0)); Label endLabel = builder.addLabel("end"); builder.addCatch(startLabel, endLabel, startLabel); MethodImplementation methodImplementation = builder.getMethodImplementation(); Assert.assertEquals(0, methodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, methodImplementation.getTryBlocks().get(0).getCodeUnitCount()); methodImplementation = new MutableMethodImplementation(methodImplementation); Assert.assertEquals(0, methodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, methodImplementation.getTryBlocks().get(0).getCodeUnitCount()); }
@Test public void testNewLabelByIndex() { MethodImplementationBuilder builder = new MethodImplementationBuilder(10); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0)); MutableMethodImplementation mutableMethodImplementation = new MutableMethodImplementation(builder.getMethodImplementation()); mutableMethodImplementation.addCatch( mutableMethodImplementation.newLabelForIndex(0), mutableMethodImplementation.newLabelForIndex(6), mutableMethodImplementation.newLabelForIndex(1)); Assert.assertEquals(0, mutableMethodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, mutableMethodImplementation.getTryBlocks().get(0).getCodeUnitCount()); Assert.assertEquals(1, mutableMethodImplementation.getTryBlocks().get(0).getExceptionHandlers().get(0) .getHandlerCodeAddress()); } }