Package jadx.core.dex.instructions

Examples of jadx.core.dex.instructions.IfNode


  private IfMakerHelper() {
  }

  static IfInfo makeIfInfo(BlockNode ifBlock) {
    IfNode ifNode = (IfNode) ifBlock.getInstructions().get(0);
    IfCondition condition = IfCondition.fromIfNode(ifNode);
    IfInfo info = new IfInfo(condition, ifNode.getThenBlock(), ifNode.getElseBlock());
    info.setIfBlock(ifBlock);
    info.getMergedBlocks().add(ifBlock);
    return info;
  }
View Full Code Here


  public boolean checkPreCondition() {
    List<InsnNode> insns = preCondition.getInstructions();
    if (insns.isEmpty()) {
      return true;
    }
    IfNode ifInsn = getIfInsn();
    int size = insns.size();
    for (int i = 0; i < size; i++) {
      InsnNode insn = insns.get(i);
      if (insn.getResult() == null) {
        return false;
      }
      RegisterArg res = insn.getResult();
      if (res.getSVar().getUseCount() > 1) {
        return false;
      }
      boolean found = false;
      // search result arg in other insns
      for (int j = i + 1; j < size; j++) {
        if (insns.get(i).containsArg(res)) {
          found = true;
        }
      }
      // or in if insn
      if (!found && ifInsn.containsArg(res)) {
        found = true;
      }
      if (!found) {
        return false;
      }
View Full Code Here

    InsnNode wrapInsn = ((InsnWrapArg) c.getA()).getWrapInsn();
    InsnType type = wrapInsn.getType();
    if (type != InsnType.CMP_L && type != InsnType.CMP_G) {
      return;
    }
    IfNode insn = c.getInsn();
    insn.changeCondition(insn.getOp(), wrapInsn.getArg(0), wrapInsn.getArg(1));
  }
View Full Code Here

import static org.junit.Assert.assertEquals;

public class TestIfCondition {

  private static IfCondition makeCondition(IfOp op, InsnArg a, InsnArg b) {
    return IfCondition.fromIfNode(new IfNode(op, -1, a, b));
  }
View Full Code Here

        break;

      /* fallback mode instructions */
      case IF:
        assert isFallback() : "if insn in not fallback mode";
        IfNode ifInsn = (IfNode) insn;
        code.add("if (");
        addArg(code, insn.getArg(0));
        code.add(' ');
        code.add(ifInsn.getOp().getSymbol()).add(' ');
        addArg(code, insn.getArg(1));
        code.add(") goto ").add(MethodGen.getLabelName(ifInsn.getTarget()));
        break;

      case GOTO:
        assert isFallback();
        code.add("goto ").add(MethodGen.getLabelName(((GotoNode) insn).getTarget()));
View Full Code Here

    return null;
  }

  private static InsnArg foundWrappedInsnInCondition(IfCondition cond, InsnNode insn) {
    if (cond.isCompare()) {
      IfNode cmpInsn = cond.getCompare().getInsn();
      return foundWrappedInsn(cmpInsn, insn);
    }
    for (IfCondition nestedCond : cond.getArgs()) {
      InsnArg res = foundWrappedInsnInCondition(nestedCond, insn);
      if (res != null) {
View Full Code Here

  }

  private static boolean isDoWhile(Map<Integer, BlockNode> blocksMap, BlockNode curBlock, InsnNode insn) {
    // split 'do-while' block (last instruction: 'if', target this block)
    if (insn.getType() == InsnType.IF) {
      IfNode ifs = (IfNode) (insn);
      BlockNode targetBlock = blocksMap.get(ifs.getTarget());
      if (targetBlock == curBlock) {
        return true;
      }
    }
    return false;
View Full Code Here

TOP

Related Classes of jadx.core.dex.instructions.IfNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.