Package jadx.core.dex.instructions.args

Examples of jadx.core.dex.instructions.args.InsnArg


    code.startLine('}');
  }

  private CodeWriter makeSwitch(SwitchRegion sw, CodeWriter code) throws CodegenException {
    SwitchNode insn = (SwitchNode) sw.getHeader().getInstructions().get(0);
    InsnArg arg = insn.getArg(0);
    code.startLine("switch (");
    addArg(code, arg, false);
    code.add(") {");
    code.incIndent();

    int size = sw.getKeys().size();
    for (int i = 0; i < size; i++) {
      List<Object> keys = sw.getKeys().get(i);
      IContainer c = sw.getCases().get(i);
      for (Object k : keys) {
        code.startLine("case ");
        if (k instanceof FieldNode) {
          FieldNode fn = (FieldNode) k;
          if (fn.getParentClass().isEnum()) {
            code.add(fn.getName());
          } else {
            staticField(code, fn.getFieldInfo());
          }
        } else if (k instanceof IndexInsnNode) {
          staticField(code, (FieldInfo) ((IndexInsnNode) k).getIndex());
        } else {
          code.add(TypeGen.literalToString((Integer) k, arg.getType()));
        }
        code.add(':');
      }
      makeCaseBlock(c, code);
    }
View Full Code Here


    IContainer region = handler.getHandlerRegion();
    if (region == null) {
      return;
    }
    code.startLine("} catch (");
    InsnArg arg = handler.getArg();
    if (arg instanceof RegisterArg) {
      declareVar(code, (RegisterArg) arg);
    } else if (arg instanceof NamedArg) {
      if (handler.isCatchAll()) {
        code.add("Throwable");
View Full Code Here

          replaceInsn(block, insnNumber, replace);
        }
      }
    } else if (inv.getArgsCount() > 0) {
      for (int j = 0; j < inv.getArgsCount(); j++) {
        InsnArg arg = inv.getArg(j);
        if (arg.isLiteral()) {
          FieldNode f = parentClass.getConstFieldByLiteralArg((LiteralArg) arg);
          if (f != null) {
            arg.wrapInstruction(new IndexInsnNode(InsnType.SGET, f.getFieldInfo(), 0));
          }
        }
      }
    }
  }
View Full Code Here

    if (insn.getType() == InsnType.ARITH) {
      ArithNode arith = (ArithNode) insn;
      ArithOp op = arith.getOp();
      if (op == ArithOp.ADD || op == ArithOp.SUB) {
        for (int i = 0; i < 2; i++) {
          InsnArg arg = arith.getArg(i);
          if (arg.isInsnWrap()) {
            InsnNode wrapInsn = ((InsnWrapArg) arg).getWrapInsn();
            wrapInsn.add(AFlag.DONT_WRAP);
            checkInsn(wrapInsn);
          }
        }
      }
    } else {
      for (InsnArg arg : insn.getArguments()) {
        if (arg.isInsnWrap()) {
          InsnNode wrapInsn = ((InsnWrapArg) arg).getWrapInsn();
          checkInsn(wrapInsn);
        }
      }
    }
View Full Code Here

  private static void modifyArith(BlockNode block) {
    List<InsnNode> list = block.getInstructions();
    for (InsnNode insn : list) {
      if (insn.getType() == InsnType.ARITH) {
        RegisterArg res = insn.getResult();
        InsnArg arg = insn.getArg(0);
        boolean replace = false;
        if (res.equals(arg)) {
          replace = true;
        } else if (arg.isRegister()) {
          RegisterArg regArg = (RegisterArg) arg;
          replace = res.equalRegisterAndType(regArg);
        }
        if (replace) {
          insn.add(AFlag.ARITH_ONEARG);
View Full Code Here

      EnumField f = it.next();
      code.startLine(f.getName());
      if (!f.getArgs().isEmpty()) {
        code.add('(');
        for (Iterator<InsnArg> aIt = f.getArgs().iterator(); aIt.hasNext(); ) {
          InsnArg arg = aIt.next();
          if (igen == null) {
            // don't init mth gen if this is simple enum
            MethodGen mthGen = new MethodGen(this, enumFields.getStaticMethod());
            igen = new InsnGen(mthGen, false);
          }
View Full Code Here

    }
  }

  private void invert() {
    condition = IfCondition.invert(condition);
    InsnArg tmp = getArg(0);
    setArg(0, getArg(1));
    setArg(1, tmp);
  }
View Full Code Here

    }
  }

  private void addCompare(CodeWriter code, CondStack stack, Compare compare) throws CodegenException {
    IfOp op = compare.getOp();
    InsnArg firstArg = compare.getA();
    InsnArg secondArg = compare.getB();
    if (firstArg.getType().equals(ArgType.BOOLEAN)
        && secondArg.isLiteral()
        && secondArg.getType().equals(ArgType.BOOLEAN)) {
      LiteralArg lit = (LiteralArg) secondArg;
      if (lit.getLiteral() == 0) {
        op = op.invert();
      }
      if (op == IfOp.EQ) {
View Full Code Here

TOP

Related Classes of jadx.core.dex.instructions.args.InsnArg

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.