@Nonnull private BuilderInstruction22c newBuilderInstruction22c(@Nonnull Instruction22c instruction) { return new BuilderInstruction22c( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), convertReference(instruction.getReference())); }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { MethodLocation child = Utils.getNextLocation(location, addressToLocation); Instruction22c instr = (Instruction22c) location.getInstruction(); int valueRegister = instr.getRegisterA(); int instanceRegister = instr.getRegisterB(); FieldReference reference = (FieldReference) instr.getReference(); String fieldDescriptor = ReferenceUtil.getFieldDescriptor(reference); return new IPutOp(location, child, valueRegister, instanceRegister, fieldDescriptor, vm); }
NewArrayInstruction newArrayInstruction = (NewArrayInstruction) i; Instruction22c instruction22c = (Instruction22c) newArrayInstruction.instruction; if (instruction22c.getRegisterA() == reg) { ArrayType arrayType = (ArrayType) DexType.toSoot((TypeReference) instruction22c.getReference()); elementType = arrayType.getElementType(); break Outer;
AnalyzedInstruction branchInstruction = analyzedInstructions.get(nextAddress); int narrowingRegister = ((Instruction22c)prevAnalyzedInstruction.instruction).getRegisterB(); RegisterType originalType = analyzedInstruction.getPreInstructionRegisterType(narrowingRegister); (TypeReference)instanceOfInstruction.getReference());
public void write(@Nonnull Instruction22c instruction) { try { writer.write(instruction.getOpcode().value); writer.write(packNibbles(instruction.getRegisterA(), instruction.getRegisterB())); writer.writeUshort(getReferenceIndex(instruction)); } catch (IOException ex) { throw new RuntimeException(ex); } }
/** * Return the source register for this instruction. */ private int sourceRegister() { // I hate smali's API .. if (instruction instanceof Instruction23x) { return ((Instruction23x) instruction).getRegisterA(); } else if (instruction instanceof Instruction22c) { return ((Instruction22c) instruction).getRegisterA(); } else if (instruction instanceof Instruction21c) { return ((Instruction21c) instruction).getRegisterA(); } else { throw new RuntimeException("Instruction is not a instance, array or static op"); } }
((Instruction22c) instruction).getRegisterA(), ((Instruction22c) instruction).getRegisterB(), immutableReference)); ((Instruction22c) instruction).getRegisterA(), ((Instruction22c) instruction).getRegisterB(), immutableFieldReference)); ((Instruction22c) instruction).getRegisterA(), ((Instruction22c) instruction).getRegisterB(), immutableTypeReference)); ((Instruction22c) instruction).getRegisterA(), ((Instruction22c) instruction).getRegisterB(), immutableStringReference));
public int getRegisterB() { return instruction.getRegisterB(); } }
static boolean canPropagateTypeAfterInstanceOf(AnalyzedInstruction analyzedInstanceOfInstruction, AnalyzedInstruction analyzedIfInstruction, ClassPath classPath) { if (!classPath.isArt()) { return false; } Instruction ifInstruction = analyzedIfInstruction.instruction; if (((Instruction21t)ifInstruction).getRegisterA() == analyzedInstanceOfInstruction.getDestinationRegister()) { Reference reference = ((Instruction22c)analyzedInstanceOfInstruction.getInstruction()).getReference(); RegisterType registerType = RegisterType.getRegisterType(classPath, (TypeReference)reference); try { if (registerType.type != null && !registerType.type.isInterface()) { int objectRegister = ((TwoRegisterInstruction)analyzedInstanceOfInstruction.getInstruction()) .getRegisterB(); RegisterType originalType = analyzedIfInstruction.getPreInstructionRegisterType(objectRegister); return isNotWideningConversion(originalType, registerType); } } catch (UnresolvedClassException ex) { return false; } } return false; }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { MethodLocation child = Utils.getNextLocation(location, addressToLocation); Instruction22c instr = (Instruction22c) location.getInstruction(); int destRegister = instr.getRegisterA(); int instanceRegister = instr.getRegisterB(); FieldReference reference = (FieldReference) instr.getReference(); String fieldDescriptor = ReferenceUtil.getFieldDescriptor(reference); return new IGetOp(location, child, destRegister, instanceRegister, fieldDescriptor, vm); }
prevInstruction, this, methodAnalyzer.getClassPath())) { Instruction22c instanceOfInstruction = (Instruction22c)prevInstruction.instruction; setRegisters.add(instanceOfInstruction.getRegisterB()); prevPrevAnalyzedInstruction.getPostInstructionRegisterType( moveInstruction.getRegisterB()); if (moveInstruction.getRegisterA() != instanceOfInstruction.getRegisterB()) { originalSourceRegister = -1; break; (TypeReference)instanceOfInstruction.getReference());
public void write(@Nonnull Instruction22c instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(packNibbles(instruction.getRegisterA(), instruction.getRegisterB())); writer.writeUshort(getReferenceIndex(instruction)); } catch (IOException ex) { throw new RuntimeException(ex); } }
public int getRegisterA() { return instruction.getRegisterA(); }
public int getRegisterB() { return instruction.getRegisterB(); } }
static boolean canPropagateTypeAfterInstanceOf(AnalyzedInstruction analyzedInstanceOfInstruction, AnalyzedInstruction analyzedIfInstruction, ClassPath classPath) { if (!classPath.isArt()) { return false; } Instruction ifInstruction = analyzedIfInstruction.instruction; if (((Instruction21t)ifInstruction).getRegisterA() == analyzedInstanceOfInstruction.getDestinationRegister()) { Reference reference = ((Instruction22c)analyzedInstanceOfInstruction.getInstruction()).getReference(); RegisterType registerType = RegisterType.getRegisterType(classPath, (TypeReference)reference); try { if (registerType.type != null && !registerType.type.isInterface()) { int objectRegister = ((TwoRegisterInstruction)analyzedInstanceOfInstruction.getInstruction()) .getRegisterB(); RegisterType originalType = analyzedIfInstruction.getPreInstructionRegisterType(objectRegister); return isNotWideningConversion(originalType, registerType); } } catch (UnresolvedClassException ex) { return false; } } return false; }
public static ImmutableInstruction22c of(Instruction22c instruction) { if (instruction instanceof ImmutableInstruction22c) { return (ImmutableInstruction22c)instruction; } return new ImmutableInstruction22c( instruction.getOpcode(), instruction.getRegisterA(), instruction.getRegisterB(), instruction.getReference()); }
@Override public Op create(MethodLocation location, TIntObjectMap<MethodLocation> addressToLocation, VirtualMachine vm) { MethodLocation child = Utils.getNextLocation(location, addressToLocation); Instruction22c instr = (Instruction22c) location.getInstruction(); int destRegister = instr.getRegisterA(); int arg1Register = instr.getRegisterB(); TypeReference typeReference = (TypeReference) instr.getReference(); VirtualType referenceType = vm.getClassManager().getVirtualType(typeReference); return new InstanceOfOp(location, child, destRegister, arg1Register, referenceType, vm); }
prevInstruction, this, methodAnalyzer.getClassPath())) { Instruction22c instanceOfInstruction = (Instruction22c)prevInstruction.instruction; setRegisters.add(instanceOfInstruction.getRegisterB()); prevPrevAnalyzedInstruction.getPostInstructionRegisterType( moveInstruction.getRegisterB()); if (moveInstruction.getRegisterA() != instanceOfInstruction.getRegisterB()) { originalSourceRegister = -1; break; (TypeReference)instanceOfInstruction.getReference());
public void write(@Nonnull Instruction22c instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(packNibbles(instruction.getRegisterA(), instruction.getRegisterB())); writer.writeUshort(getReferenceIndex(instruction)); } catch (IOException ex) { throw new RuntimeException(ex); } }
public int getRegisterA() { return instruction.getRegisterA(); }