com.android.dx.rop.code.BasicBlock.getPrimarySuccessor()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(72)

本文整理了Java中com.android.dx.rop.code.BasicBlock.getPrimarySuccessor()方法的一些代码示例,展示了BasicBlock.getPrimarySuccessor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BasicBlock.getPrimarySuccessor()方法的具体详情如下:
包路径:com.android.dx.rop.code.BasicBlock
类名称:BasicBlock
方法名:getPrimarySuccessor

BasicBlock.getPrimarySuccessor介绍

[英]Gets the primary successor of this block.
[中]获取此块的主要后续对象。

代码示例

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: gdpancheng/LoonAndroid3

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: com.google.dexmaker/dexmaker-dx

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: com.android/dx

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Looks forward to the current block's primary successor, returning
 * the RegisterSpec of the result of the move-result-pseudo at the
 * top of that block or null if none.
 *
 * @return {@code null-ok;} result of move-result-pseudo at the beginning of
 * primary successor
 */
private RegisterSpec getNextMoveResultPseudo()
{
  int label = block.getPrimarySuccessor();
  if (label < 0) {
    return null;
  }
  Insn insn
      = method.getBlocks().labelToBlock(label).getInsns().get(0);
  if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) {
    return null;
  } else {
    return insn.getResult();
  }            
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Gets the preferred successor for the given block. If the block
 * only has one successor, then that is the preferred successor.
 * Otherwise, if the block has a primay successor, then that is
 * the preferred successor. If the block has no successors, then
 * this returns {@code null}.
 *
 * @param block {@code non-null;} the block in question
 * @return {@code null-ok;} the preferred successor, if any
 */
public BasicBlock preferredSuccessorOf(BasicBlock block) {
  int primarySuccessor = block.getPrimarySuccessor();
  IntList successors = block.getSuccessors();
  int succSize = successors.size();
  switch (succSize) {
    case 0: {
      return null;
    }
    case 1: {
      return labelToBlock(successors.get(0));
    }
  }
  if (primarySuccessor != -1) {
    return labelToBlock(primarySuccessor);
  } else {
    return labelToBlock(successors.get(0));
  }
}

代码示例来源:origin: com.google.dexmaker/dexmaker-dx

/**
 * Gets the preferred successor for the given block. If the block
 * only has one successor, then that is the preferred successor.
 * Otherwise, if the block has a primay successor, then that is
 * the preferred successor. If the block has no successors, then
 * this returns {@code null}.
 *
 * @param block {@code non-null;} the block in question
 * @return {@code null-ok;} the preferred successor, if any
 */
public BasicBlock preferredSuccessorOf(BasicBlock block) {
  int primarySuccessor = block.getPrimarySuccessor();
  IntList successors = block.getSuccessors();
  int succSize = successors.size();
  switch (succSize) {
    case 0: {
      return null;
    }
    case 1: {
      return labelToBlock(successors.get(0));
    }
  }
  if (primarySuccessor != -1) {
    return labelToBlock(primarySuccessor);
  } else {
    return labelToBlock(successors.get(0));
  }
}

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Gets the preferred successor for the given block. If the block
 * only has one successor, then that is the preferred successor.
 * Otherwise, if the block has a primay successor, then that is
 * the preferred successor. If the block has no successors, then
 * this returns {@code null}.
 *
 * @param block {@code non-null;} the block in question
 * @return {@code null-ok;} the preferred successor, if any
 */
public BasicBlock preferredSuccessorOf(BasicBlock block) {
  int primarySuccessor = block.getPrimarySuccessor();
  IntList successors = block.getSuccessors();
  int succSize = successors.size();
  switch (succSize) {
    case 0: {
      return null;
    }
    case 1: {
      return labelToBlock(successors.get(0));
    }
  }
  if (primarySuccessor != -1) {
    return labelToBlock(primarySuccessor);
  } else {
    return labelToBlock(successors.get(0));
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Gets the preferred successor for the given block. If the block
 * only has one successor, then that is the preferred successor.
 * Otherwise, if the block has a primay successor, then that is
 * the preferred successor. If the block has no successors, then
 * this returns {@code null}.
 *
 * @param block {@code non-null;} the block in question
 * @return {@code null-ok;} the preferred successor, if any
 */
public BasicBlock preferredSuccessorOf(BasicBlock block) {
  int primarySuccessor = block.getPrimarySuccessor();
  IntList successors = block.getSuccessors();
  int succSize = successors.size();
  switch (succSize) {
    case 0: {
      return null;
    }
    case 1: {
      return labelToBlock(successors.get(0));
    }
  }
  if (primarySuccessor != -1) {
    return labelToBlock(primarySuccessor);
  } else {
    return labelToBlock(successors.get(0));
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: nikita36078/J2ME-Loader

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: com.android.tools.build/builder

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: com.google.dexmaker/dexmaker-dx

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: com.android/dx

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: gdpancheng/LoonAndroid3

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

代码示例来源:origin: com.google.android.tools/dx

/**
   * Replaces one of a block's successors with a different label. Constructs
   * an updated BasicBlock instance and places it in {@code newBlocks}.
   *
   * @param block block to replace
   * @param oldLabel label of successor to replace
   * @param newLabel label of new successor
   */
  private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
        block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
}

相关文章