@Override public void visitSparseSwitchPayloadInsn(int currentAddress, int opcode, int[] keys, int[] targets) { mapAddressIfNeeded(currentAddress); this.currentPromotedAddress += 2; this.currentPromotedAddress += keys.length * 2; this.currentPromotedAddress += targets.length * 2; }
public void visitPackedSwitchPayloadInsn(int currentAddress, int opcode, int firstKey, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); codeOut.writeInt(firstKey); if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }
public void visitSparseSwitchPayloadInsn(int currentAddress, int opcode, int[] keys, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); for (int key : keys) { codeOut.writeInt(key); } if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }
@Override public void visitPackedSwitchPayloadInsn(int currentAddress, int opcode, int firstKey, int[] targets) { mapAddressIfNeeded(currentAddress); this.currentPromotedAddress += 2 + 2; this.currentPromotedAddress += targets.length * 2; }
public void visitZeroRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal) { if (this.hasPromoter) { target = this.insnPromoter.getPromotedAddress(target);
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }
@Override public void visitFourRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b, int c, int d) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.FILLED_NEW_ARRAY: case Opcodes.INVOKE_VIRTUAL: case Opcodes.INVOKE_SUPER: case Opcodes.INVOKE_DIRECT: case Opcodes.INVOKE_STATIC: case Opcodes.INVOKE_INTERFACE: { this.currentPromotedAddress += 3; break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
public void visitTwoRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b) { if (this.hasPromoter) { target = this.insnPromoter.getPromotedAddress(target);
@Override public void visitRegisterRangeInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int registerCount) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.FILLED_NEW_ARRAY_RANGE: case Opcodes.INVOKE_VIRTUAL_RANGE: case Opcodes.INVOKE_SUPER_RANGE: case Opcodes.INVOKE_DIRECT_RANGE: case Opcodes.INVOKE_STATIC_RANGE: case Opcodes.INVOKE_INTERFACE_RANGE: { this.currentPromotedAddress += 3; break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
public void visitOneRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a) { if (this.hasPromoter) { target = this.insnPromoter.getPromotedAddress(target);
@Override public void visitFiveRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b, int c, int d, int e) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.FILLED_NEW_ARRAY: case Opcodes.INVOKE_VIRTUAL: case Opcodes.INVOKE_SUPER: case Opcodes.INVOKE_DIRECT: case Opcodes.INVOKE_STATIC: case Opcodes.INVOKE_INTERFACE: { this.currentPromotedAddress += 3; break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
public void visitPackedSwitchPayloadInsn(int currentAddress, int opcode, int firstKey, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); codeOut.writeInt(firstKey); if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
@Override public void visitThreeRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b, int c) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.CMPL_FLOAT:
public void visitSparseSwitchPayloadInsn(int currentAddress, int opcode, int[] keys, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); for (int key : keys) { codeOut.writeInt(key); } if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
@Override public void visitOneRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.CONST_STRING: {
public void visitZeroRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal) { if (this.hasPromoter) { target = this.insnPromoter.getPromotedAddress(target);
@Override public void visitTwoRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b) { mapAddressIfNeeded(currentAddress); switch (opcode) { case Opcodes.MOVE:
public void visitTwoRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b) { if (this.hasPromoter) { target = this.insnPromoter.getPromotedAddress(target);