private InsnNode invoke(DecodedInstruction insn, int offset, InvokeType type, boolean isRange) { int resReg = getMoveResultRegister(insnArr, offset); MethodInfo mth = MethodInfo.fromDex(dex, insn.getIndex()); return new InvokeNode(mth, insn, type, isRange, resReg); }
private InsnNode filledNewArray(DecodedInstruction insn, int offset, boolean isRange) { int resReg = getMoveResultRegister(insnArr, offset); ArgType arrType = dex.getType(insn.getIndex()); ArgType elType = arrType.getArrayElement(); boolean typeImmutable = elType.isPrimitive(); int regsCount = insn.getRegisterCount(); InsnArg[] regs = new InsnArg[regsCount]; if (isRange) { int r = insn.getA(); for (int i = 0; i < regsCount; i++) { regs[i] = InsnArg.reg(r, elType, typeImmutable); r++; } } else { for (int i = 0; i < regsCount; i++) { int regNum = InsnUtils.getArg(insn, i); regs[i] = InsnArg.reg(regNum, elType, typeImmutable); } } InsnNode node = new FilledNewArrayNode(elType, regs.length); node.setResult(resReg == -1 ? null : InsnArg.reg(resReg, arrType)); for (InsnArg arg : regs) { node.addArg(arg); } return node; }
InsnNode constStrInsn = new ConstStringNode(dex.getString(insn.getIndex())); constStrInsn.setResult(InsnArg.reg(insn, 0, ArgType.STRING)); return constStrInsn; InsnNode constClsInsn = new ConstClassNode(dex.getType(insn.getIndex())); constClsInsn.setResult(InsnArg.reg(insn, 0, ArgType.CLASS)); return constClsInsn; InsnNode instInsn = new IndexInsnNode(InsnType.INSTANCE_OF, dex.getType(insn.getIndex()), 1); instInsn.setResult(InsnArg.reg(insn, 0, ArgType.BOOLEAN)); instInsn.addArg(InsnArg.reg(insn, 1, ArgType.UNKNOWN_OBJECT)); ArgType castType = dex.getType(insn.getIndex()); InsnNode checkCastInsn = new IndexInsnNode(InsnType.CHECK_CAST, castType, 1); checkCastInsn.setResult(InsnArg.reg(insn, 0, castType)); case Opcodes.IGET_WIDE: case Opcodes.IGET_OBJECT: FieldInfo igetFld = FieldInfo.fromDex(dex, insn.getIndex()); InsnNode igetInsn = new IndexInsnNode(InsnType.IGET, igetFld, 1); igetInsn.setResult(InsnArg.reg(insn, 0, igetFld.getType())); case Opcodes.IPUT_WIDE: case Opcodes.IPUT_OBJECT: FieldInfo iputFld = FieldInfo.fromDex(dex, insn.getIndex()); InsnNode iputInsn = new IndexInsnNode(InsnType.IPUT, iputFld, 2); iputInsn.addArg(InsnArg.reg(insn, 0, iputFld.getType())); case Opcodes.SGET_WIDE:
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int fieldId = one.getIndex(); if (fieldIds.contains(fieldId)) { out.println(location() + ": field reference " + dex.fieldIds().get(fieldId) + " (" + OpcodeInfo.getName(one.getOpcode()) + ")"); } } });
@Override public void visit(DecodedInstruction[] all, DecodedInstruction one) { int methodId = one.getIndex(); if (methodIds.contains(methodId)) { out.println(location() + ": method reference " + dex.methodIds().get(methodId) + " (" + OpcodeInfo.getName(one.getOpcode()) + ")"); } } });
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int methodId = one.getIndex(); if (methodIds.contains(methodId)) { out.println(location() + ": method reference " + dex.methodIds().get(methodId) + " (" + OpcodeInfo.getName(one.getOpcode()) + ")"); } } });
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int stringId = one.getIndex(); int mappedId = indexMap.adjustString(stringId); jumboCheck(stringId, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( codeUnit(insn.getOpcode(), insn.getA()), unit0(index), unit1(index)); } },
@Override public void visit(DecodedInstruction[] all, DecodedInstruction one) { int methodId = one.getIndex(); int mappedId = indexMap.adjustMethod(methodId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( codeUnit(insn.getOpcode(), insn.getA()), unit0(index), unit1(index)); } },
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int fieldId = one.getIndex(); int mappedId = indexMap.adjustField(fieldId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( codeUnit(insn.getOpcode(), insn.getA()), unit0(index), unit1(index)); } },
@Override public void visit(DecodedInstruction[] all, DecodedInstruction one) { int stringId = one.getIndex(); int mappedId = indexMap.adjustString(stringId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int typeId = one.getIndex(); int mappedId = indexMap.adjustType(typeId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int methodId = one.getIndex(); int mappedId = indexMap.adjustMethod(methodId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( insn.getOpcodeUnit(), unit0(index), unit1(index), insn.getLiteralUnit()); } },
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int stringId = one.getIndex(); int mappedId = indexMap.adjustString(stringId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
public void visit(DecodedInstruction[] all, DecodedInstruction one) { int methodId = one.getIndex(); int mappedId = indexMap.adjustMethod(methodId); boolean isJumbo = (one.getOpcode() == Opcodes.CONST_STRING_JUMBO); jumboCheck(isJumbo, mappedId); mappedInstructions[mappedAt++] = one.withIndex(mappedId); } }
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( insn.getOpcodeUnit(), unit0(index), unit1(index), insn.getAUnit(), insn.getBUnit()); } },
@Override public void encode(DecodedInstruction insn, CodeOutput out) { int index = insn.getIndex(); out.write( insn.getOpcodeUnit(), unit0(index), unit1(index), insn.getRegisterCountUnit(), insn.getAUnit()); } },