@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Override protected IfStmt ifStatement(DexBody body) { Instruction21t i = (Instruction21t) instruction; BinopExpr condition = getComparisonExpr(body, i.getRegisterA()); IfStmt jif = Jimple.v().newIfStmt(condition, targetInstruction.getUnit()); // setUnit() is called in ConditionalJumpInstruction addTags(jif); if (IDalvikTyper.ENABLE_DVKTYPER) { // Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ jif); /* * int op = instruction.getOpcode().value; switch (op) { case 0x38: case 0x39: * //DalvikTyper.v().addConstraint(condition.getOp1Box(), condition.getOp2Box()); break; case 0x3a: case 0x3b: case * 0x3c: case 0x3d: DalvikTyper.v().setType(condition.getOp1Box(), BooleanType.v(), true); break; default: throw new * RuntimeException("error: unknown op: 0x"+ Integer.toHexString(op)); } */ } return jif; } }
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; }
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) { return new BuilderInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset())); }
public static ImmutableInstruction21t of(Instruction21t instruction) { if (instruction instanceof ImmutableInstruction21t) { return (ImmutableInstruction21t)instruction; } return new ImmutableInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), instruction.getCodeOffset()); }
public static ImmutableInstruction21t of(Instruction21t instruction) { if (instruction instanceof ImmutableInstruction21t) { return (ImmutableInstruction21t)instruction; } return new ImmutableInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), instruction.getCodeOffset()); }
public static ImmutableInstruction21t of(Instruction21t instruction) { if (instruction instanceof ImmutableInstruction21t) { return (ImmutableInstruction21t)instruction; } return new ImmutableInstruction21t( instruction.getOpcode(), instruction.getRegisterA(), instruction.getCodeOffset()); }
public void write(@Nonnull Instruction21t instruction) { try { writer.write(instruction.getOpcode().value); writer.write(instruction.getRegisterA()); writer.writeShort(instruction.getCodeOffset()); } catch (IOException ex) { throw new RuntimeException(ex); } }
public void write(@Nonnull Instruction21t instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(instruction.getRegisterA()); writer.writeShort(instruction.getCodeOffset()); } catch (IOException ex) { throw new RuntimeException(ex); } }
public void write(@Nonnull Instruction21t instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(instruction.getRegisterA()); writer.writeShort(instruction.getCodeOffset()); } catch (IOException ex) { throw new RuntimeException(ex); } }
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; }
instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.EQZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_NEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.NEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_LTZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.LTZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_GEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.GEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_GTZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.GTZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_LEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.LEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break;
instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.EQZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_NEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.NEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_LTZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.LTZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_GEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.GEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_GTZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.GTZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break; case IF_LEZ: instructions.add(new Branch.UnaryBranch(instLoc, ((Instruction21t)inst).getCodeOffset(), Branch.UnaryBranch.CompareOp.LEZ, ((Instruction21t)inst).getRegisterA(), inst.getOpcode(), this)); break;