org.objectweb.asm.tree.InsnList.indexOf()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(91)

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

InsnList.indexOf介绍

[英]Returns the index of the given instruction in this list. This method builds a cache of the instruction indexes to avoid scanning the whole list each time it is called. Once the cache is built, this method run in constant time. The cache is invalidated by all the methods that modify the list.
[中]返回此列表中给定指令的索引。此方法构建指令索引的缓存,以避免每次调用时扫描整个列表。构建缓存后,此方法将以恒定时间运行。所有修改列表的方法都会使缓存无效。

代码示例

代码示例来源:origin: pxb1988/dex2jar

if (p.getType() == AbstractInsnNode.JUMP_INSN) {
  JumpInsnNode jump = (JumpInsnNode) p;
  parentCount[insnList.indexOf(jump.label)]++;
    TableSwitchInsnNode tsin = (TableSwitchInsnNode) p;
    for (LabelNode label : tsin.labels) {
      parentCount[insnList.indexOf(label)]++;
    parentCount[insnList.indexOf(tsin.dflt)]++;
  } else {
    LookupSwitchInsnNode lsin = (LookupSwitchInsnNode) p;
    for (LabelNode label : lsin.labels) {
      parentCount[insnList.indexOf(label)]++;
    parentCount[insnList.indexOf(lsin.dflt)]++;
  AbstractInsnNode next = p.getNext();
  if(next!=null) {
    parentCount[insnList.indexOf(p.getNext())]++;

代码示例来源:origin: pxb1988/dex2jar

int index = insnList.indexOf(p);
if (!access.get(index)) {
  access.set(index);
  JumpInsnNode jump = (JumpInsnNode) p;
  stack.push(jump.label);
  merge(tmp, insnList.indexOf(jump.label));
    for (LabelNode label : tsin.labels) {
      stack.push(label);
      merge(tmp, insnList.indexOf(label));
    merge(tmp, insnList.indexOf(tsin.dflt));
    for (LabelNode label : lsin.labels) {
      stack.push(label);
      merge(tmp, insnList.indexOf(label));
    merge(tmp, insnList.indexOf(lsin.dflt));

代码示例来源:origin: pxb1988/dex2jar

target.traps.add(new Trap(getLabel(tcb.start), getLabel(tcb.end), new LabelStmt[]{getLabel(tcb.handler)},
    new String[]{tcb.type == null ? null : Type.getObjectType(tcb.type).getDescriptor()}));
int handlerIdx = insnList.indexOf(tcb.handler);
handlers.set(handlerIdx);
  BitSet x = exBranch[insnList.indexOf(p)];
  if (x == null) {
    x = exBranch[insnList.indexOf(p)] = new BitSet(insnList.size());

代码示例来源:origin: org.ow2.asm/asm-commons

private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
  int startIndex = instructions.indexOf(tryCatchBlockNode.start);
  int endIndex = instructions.indexOf(tryCatchBlockNode.end);
  return endIndex - startIndex;
 }
});

代码示例来源:origin: org.ow2.asm/asm-debug-all

private int blockLength(TryCatchBlockNode block) {
    int startidx = instructions.indexOf(block.start);
    int endidx = instructions.indexOf(block.end);
    return endidx - startidx;
  }
};

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
  int startIndex = instructions.indexOf(tryCatchBlockNode.start);
  int endIndex = instructions.indexOf(tryCatchBlockNode.end);
  return endIndex - startIndex;
 }
});

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
  int startIndex = instructions.indexOf(tryCatchBlockNode.start);
  int endIndex = instructions.indexOf(tryCatchBlockNode.end);
  return endIndex - startIndex;
 }
});

代码示例来源:origin: org.ow2.asm/asm-commons

/**
 * Returns the clone of the given original label that is appropriate for use in a jump
 * instruction.
 *
 * @param labelNode a label of the original code.
 * @return a clone of the given label for use in a jump instruction in the inlined code.
 */
LabelNode getClonedLabelForJumpInsn(final LabelNode labelNode) {
 // findOwner should never return null, because owner is null only if an instruction cannot be
 // reached from this subroutine.
 return findOwner(instructions.indexOf(labelNode)).clonedLabels.get(labelNode);
}

代码示例来源:origin: org.parboiled/parboiled-java

public int compare(InstructionGraphNode a, InstructionGraphNode b) {
    return Integer.valueOf(instructions.indexOf(a.getInstruction()))
        .compareTo(instructions.indexOf(b.getInstruction()));
  }
});

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

/**
 * Returns the clone of the given original label that is appropriate for use in a jump
 * instruction.
 *
 * @param labelNode a label of the original code.
 * @return a clone of the given label for use in a jump instruction in the inlined code.
 */
LabelNode getClonedLabelForJumpInsn(final LabelNode labelNode) {
 // findOwner should never return null, because owner is null only if an instruction cannot be
 // reached from this subroutine.
 return findOwner(instructions.indexOf(labelNode)).clonedLabels.get(labelNode);
}

代码示例来源:origin: net.tascalate.javaflow/net.tascalate.javaflow.providers.asm5

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

/**
 * Returns the clone of the given original label that is appropriate for use in a jump
 * instruction.
 *
 * @param labelNode a label of the original code.
 * @return a clone of the given label for use in a jump instruction in the inlined code.
 */
LabelNode getClonedLabelForJumpInsn(final LabelNode labelNode) {
 // findOwner should never return null, because owner is null only if an instruction cannot be
 // reached from this subroutine.
 return findOwner(instructions.indexOf(labelNode)).clonedLabels.get(labelNode);
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: Glitchfiend/SereneSeasons

public static void clearNextInstructions(MethodNode methodNode, AbstractInsnNode insnNode)
{
  Iterator<AbstractInsnNode> iterator = methodNode.instructions.iterator(methodNode.instructions.indexOf(insnNode));
  
  while (iterator.hasNext())
  {
    iterator.next();
    iterator.remove();
  }
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame<BasicValue> getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame<BasicValue>[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: org.ow2.asm/asm-commons

/** Determines, for each instruction, to which subroutine(s) it belongs. */
private void findSubroutinesInsns() {
 // Find the instructions that belong to main subroutine.
 BitSet visitedInsns = new BitSet();
 findSubroutineInsns(0, mainSubroutineInsns, visitedInsns);
 // For each subroutine, find the instructions that belong to this subroutine.
 for (Map.Entry<LabelNode, BitSet> entry : subroutinesInsns.entrySet()) {
  LabelNode jsrLabelNode = entry.getKey();
  BitSet subroutineInsns = entry.getValue();
  findSubroutineInsns(instructions.indexOf(jsrLabelNode), subroutineInsns, visitedInsns);
 }
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

/** Determines, for each instruction, to which subroutine(s) it belongs. */
private void findSubroutinesInsns() {
 // Find the instructions that belong to main subroutine.
 BitSet visitedInsns = new BitSet();
 findSubroutineInsns(0, mainSubroutineInsns, visitedInsns);
 // For each subroutine, find the instructions that belong to this subroutine.
 for (Map.Entry<LabelNode, BitSet> entry : subroutinesInsns.entrySet()) {
  LabelNode jsrLabelNode = entry.getKey();
  BitSet subroutineInsns = entry.getValue();
  findSubroutineInsns(instructions.indexOf(jsrLabelNode), subroutineInsns, visitedInsns);
 }
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

/** Determines, for each instruction, to which subroutine(s) it belongs. */
private void findSubroutinesInsns() {
 // Find the instructions that belong to main subroutine.
 BitSet visitedInsns = new BitSet();
 findSubroutineInsns(0, mainSubroutineInsns, visitedInsns);
 // For each subroutine, find the instructions that belong to this subroutine.
 for (Map.Entry<LabelNode, BitSet> entry : subroutinesInsns.entrySet()) {
  LabelNode jsrLabelNode = entry.getKey();
  BitSet subroutineInsns = entry.getValue();
  findSubroutineInsns(instructions.indexOf(jsrLabelNode), subroutineInsns, visitedInsns);
 }
}

代码示例来源:origin: EvoSuite/evosuite

public boolean isBooleanOnStack(MethodNode mn, AbstractInsnNode node, int position) {
  int insnPosition = mn.instructions.indexOf(node);
  if (insnPosition >= currentFrames.length) {
    logger.info("Trying to access frame out of scope: " + insnPosition + "/"
        + currentFrames.length);
    return false;
  }
  Frame frame = currentFrames[insnPosition];
  return frame.getStack(frame.getStackSize() - 1 - position) == BooleanValueInterpreter.BOOLEAN_VALUE;
}

代码示例来源:origin: fge/grappa

private int getIndexOfFirstInsn(final InstructionGroup group)
{
  return method.instructions
    .indexOf(group.getNodes().get(0).getInstruction());
}

相关文章