Package jadx.core.dex.instructions.args

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


    }
    boolean pass = true;
    if (!insns.isEmpty()) {
      // check that all instructions can be inlined
      for (InsnNode insn : insns) {
        RegisterArg res = insn.getResult();
        if (res == null) {
          pass = false;
          break;
        }
        List<RegisterArg> useList = res.getSVar().getUseList();
        if (useList.size() != 1) {
          pass = false;
          break;
        }
        InsnArg arg = useList.get(0);
View Full Code Here


    }
    List<RegisterArg> args = mth.getArguments(false);
    if (args.isEmpty()) {
      return false;
    }
    RegisterArg arg = args.get(0);
    if (!arg.getType().equals(fieldsCls.getClassInfo().getType())) {
      return false;
    }
    BlockNode block = mth.getBasicBlocks().get(0);
    List<InsnNode> instructions = block.getInstructions();
    if (instructions.isEmpty()) {
      return false;
    }
    InsnNode insn = instructions.get(0);
    if (insn.getType() != InsnType.IPUT) {
      return false;
    }
    IndexInsnNode putInsn = (IndexInsnNode) insn;
    FieldInfo fieldInfo = (FieldInfo) putInsn.getIndex();
    if (!fieldInfo.equals(field.getFieldInfo()) || !putInsn.getArg(0).equals(arg)) {
      return false;
    }
    mth.removeFirstArgument();
    InstructionRemover.remove(mth, block, insn);
    // other arg usage -> wrap with IGET insn
    if (arg.getSVar().getUseCount() != 0) {
      InsnNode iget = new IndexInsnNode(InsnType.IGET, fieldInfo, 1);
      iget.addArg(insn.getArg(1));
      for (InsnArg insnArg : arg.getSVar().getUseList()) {
        insnArg.wrapInstruction(iget);
      }
    }
    return true;
  }
View Full Code Here

    for (InsnNode insnNode : instructions) {
      if (insnNode == null) {
        continue;
      }
      list.clear();
      RegisterArg resultArg = insnNode.getResult();
      if (resultArg != null) {
        list.add(resultArg);
      }
      insnNode.getRegisterArgs(list);
      for (int i = 0, listSize = list.size(); i < listSize; i++) {
View Full Code Here

        return false;
      }
      InsnList.remove(tb, t);
      InsnList.remove(eb, e);

      RegisterArg resArg;
      if (phi.getArgsCount() == 2) {
        resArg = phi.getResult();
      } else {
        resArg = t.getResult();
        phi.removeArg(e.getResult());
View Full Code Here

    }
    return usage;
  }

  private static boolean declareAtAssign(Usage u) {
    RegisterArg arg = u.getArg();
    InsnNode parentInsn = arg.getParentInsn();
    if (!arg.equals(parentInsn.getResult())) {
      return false;
    }
    parentInsn.add(AFlag.DECLARE_VAR);
    processVar(arg);
    return true;
View Full Code Here

    void processInsn(InsnNode insn, IRegion curRegion) {
      if (insn == null) {
        return;
      }
      // result
      RegisterArg result = insn.getResult();
      if (result != null && result.isRegister()) {
        Usage u = addToUsageMap(result, usageMap);
        if (u.getArg() == null) {
          u.setArg(result);
          u.setArgRegion(curRegion);
        }
View Full Code Here

      for (InsnArg arg : insn.getArguments()) {
        if (arg.isRegister()) {
          activeRegisters[((RegisterArg) arg).getRegNum()] = arg;
        }
      }
      RegisterArg res = insn.getResult();
      if (res != null) {
        activeRegisters[res.getRegNum()] = res;
      }
    }
    setSourceLines(addr, newAddr, line);
    return newAddr;
  }
View Full Code Here

    }
  }

  private static void merge(InsnArg arg, LocalVar var) {
    if (arg != null && arg.isRegister()) {
      RegisterArg reg = (RegisterArg) arg;
      if (var.getRegNum() == reg.getRegNum()) {
        SSAVar ssaVar = reg.getSVar();

        boolean mergeRequired = false;

        if (ssaVar != null) {
          int ssaEnd = ssaVar.getEndAddr();
          int ssaStart = ssaVar.getStartAddr();
          int localStart = var.getStartAddr();
          int localEnd = var.getEndAddr();

          boolean isIntersected = !((localEnd < ssaStart) || (ssaEnd < localStart));
          if (isIntersected && (ssaEnd <= localEnd)) {
            mergeRequired = true;
          }
        } else {
          mergeRequired = true;
        }

        if (mergeRequired) {
          reg.mergeDebugInfo(var.getType(), var.getName());
        }
      }
    }
  }
View Full Code Here

  private static boolean checkForIndexedLoop(MethodNode mth, LoopRegion loopRegion, IfCondition condition) {
    InsnNode incrInsn = RegionUtils.getLastInsn(loopRegion);
    if (incrInsn == null) {
      return false;
    }
    RegisterArg incrArg = incrInsn.getResult();
    if (incrArg == null
        || incrArg.getSVar() == null
        || !incrArg.getSVar().isUsedInPhi()) {
      return false;
    }
    PhiInsn phiInsn = incrArg.getSVar().getUsedInPhi();
    if (phiInsn == null
        || phiInsn.getArgsCount() != 2
        || !phiInsn.getArg(1).equals(incrArg)
        || incrArg.getSVar().getUseCount() != 1) {
      return false;
    }
    RegisterArg arg = phiInsn.getResult();
    List<RegisterArg> condArgs = condition.getRegisterArgs();
    if (!condArgs.contains(arg) || arg.getSVar().isUsedInPhi()) {
      return false;
    }
    RegisterArg initArg = phiInsn.getArg(0);
    InsnNode initInsn = initArg.getAssignInsn();
    if (initInsn == null || initArg.getSVar().getUseCount() != 1) {
      return false;
    }
    if (!usedOnlyInLoop(mth, loopRegion, arg)) {
      return false;
    }
View Full Code Here

    List<RegisterArg> args = sVar.getUseList();
    if (args.size() != 3 || args.get(2) != condArg) {
      return null;
    }
    condArg = args.get(0);
    RegisterArg arrIndex = args.get(1);
    InsnNode arrGetInsn = arrIndex.getParentInsn();
    if (arrGetInsn == null || arrGetInsn.getType() != InsnType.AGET) {
      return null;
    }
    if (!condition.isCompare()) {
      return null;
    }
    Compare compare = condition.getCompare();
    if (compare.getOp() != IfOp.LT || compare.getA() != condArg) {
      return null;
    }
    InsnNode len;
    InsnArg bCondArg = compare.getB();
    if (bCondArg.isInsnWrap()) {
      len = ((InsnWrapArg) bCondArg).getWrapInsn();
    } else if (bCondArg.isRegister()) {
      len = ((RegisterArg) bCondArg).getAssignInsn();
    } else {
      return null;
    }
    if (len == null || len.getType() != InsnType.ARRAY_LENGTH) {
      return null;
    }
    InsnArg arrayArg = len.getArg(0);
    if (!arrayArg.equals(arrGetInsn.getArg(0))) {
      return null;
    }
    RegisterArg iterVar = arrGetInsn.getResult();
    if (iterVar == null) {
      return null;
    }

    // array for each loop confirmed
View Full Code Here

TOP

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

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.