org.objectweb.asm.Label.getCanonicalInstance()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(144)

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

Label.getCanonicalInstance介绍

[英]Returns the "canonical" Label instance corresponding to this label's bytecode offset, if known, otherwise the label itself. The canonical instance is the first label (in the order of their visit by MethodVisitor#visitLabel) corresponding to this bytecode offset. It cannot be known for labels which have not been visited yet.

This method should only be used when the MethodWriter#COMPUTE_ALL_FRAMES option is used.
[中]返回与此标签的字节码偏移量(如果已知)对应的“规范”标签实例,否则返回标签本身。规范实例是与此字节码偏移量对应的第一个标签(按照MethodVisitor#visitLabel访问的顺序)。尚未访问过的标签无法识别。
仅当使用MethodWriter#COMPUTE_ALL_FRAMES选项时,才应使用此方法。

代码示例

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

private void visitSwitchInsn(final Label dflt, final Label[] labels) {
 if (currentBasicBlock != null) {
  if (compute == COMPUTE_ALL_FRAMES) {
   currentBasicBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null);
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(Edge.JUMP, dflt);
   dflt.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(Edge.JUMP, label);
    label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   }
  } else if (compute == COMPUTE_MAX_STACK_AND_LOCAL) {
   // No need to update maxRelativeStackSize (the stack size delta is always negative).
   --relativeStackSize;
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(relativeStackSize, dflt);
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(relativeStackSize, label);
   }
  }
  // End the current basic block.
  endCurrentBasicBlockWithNoSuccessor();
 }
}

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

int catchType = Frame.getAbstractTypeFromInternalName(symbolTable, catchTypeDescriptor);
Label handlerBlock = handler.handlerPc.getCanonicalInstance();
handlerBlock.flags |= Label.FLAG_JUMP_TARGET;
Label handlerRangeBlock = handler.startPc.getCanonicalInstance();
Label handlerRangeEnd = handler.endPc.getCanonicalInstance();
while (handlerRangeBlock != handlerRangeEnd) {
 handlerRangeBlock.outgoingEdges =
 Label successorBlock = outgoingEdge.successor.getCanonicalInstance();
 boolean successorBlockChanged =
   basicBlock.frame.merge(symbolTable, successorBlock.frame, outgoingEdge.info);

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

currentBasicBlock.frame.execute(baseOpcode, 0, null, null);
label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;

代码示例来源:origin: com.bladejava/blade-asm

private void visitSwitchInsn(final Label dflt, final Label[] labels) {
 if (currentBasicBlock != null) {
  if (compute == COMPUTE_ALL_FRAMES) {
   currentBasicBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null);
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(Edge.JUMP, dflt);
   dflt.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(Edge.JUMP, label);
    label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   }
  } else if (compute == COMPUTE_MAX_STACK_AND_LOCAL) {
   // No need to update maxRelativeStackSize (the stack size delta is always negative).
   --relativeStackSize;
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(relativeStackSize, dflt);
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(relativeStackSize, label);
   }
  }
  // End the current basic block.
  endCurrentBasicBlockWithNoSuccessor();
 }
}

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

private void visitSwitchInsn(final Label dflt, final Label[] labels) {
 if (currentBasicBlock != null) {
  if (compute == COMPUTE_ALL_FRAMES) {
   currentBasicBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null);
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(Edge.JUMP, dflt);
   dflt.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(Edge.JUMP, label);
    label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   }
  } else if (compute == COMPUTE_MAX_STACK_AND_LOCAL) {
   // No need to update maxRelativeStackSize (the stack size delta is always negative).
   --relativeStackSize;
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(relativeStackSize, dflt);
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(relativeStackSize, label);
   }
  }
  // End the current basic block.
  endCurrentBasicBlockWithNoSuccessor();
 }
}

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

private void visitSwitchInsn(final Label dflt, final Label[] labels) {
 if (currentBasicBlock != null) {
  if (compute == COMPUTE_ALL_FRAMES) {
   currentBasicBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null);
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(Edge.JUMP, dflt);
   dflt.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(Edge.JUMP, label);
    label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;
   }
  } else if (compute == COMPUTE_MAX_STACK_AND_LOCAL) {
   // No need to update maxRelativeStackSize (the stack size delta is always negative).
   --relativeStackSize;
   // Add all the labels as successors of the current basic block.
   addSuccessorToCurrentBasicBlock(relativeStackSize, dflt);
   for (Label label : labels) {
    addSuccessorToCurrentBasicBlock(relativeStackSize, label);
   }
  }
  // End the current basic block.
  endCurrentBasicBlockWithNoSuccessor();
 }
}

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

int catchType = Frame.getAbstractTypeFromInternalName(symbolTable, catchTypeDescriptor);
Label handlerBlock = handler.handlerPc.getCanonicalInstance();
handlerBlock.flags |= Label.FLAG_JUMP_TARGET;
Label handlerRangeBlock = handler.startPc.getCanonicalInstance();
Label handlerRangeEnd = handler.endPc.getCanonicalInstance();
while (handlerRangeBlock != handlerRangeEnd) {
 handlerRangeBlock.outgoingEdges =
 Label successorBlock = outgoingEdge.successor.getCanonicalInstance();
 boolean successorBlockChanged =
   basicBlock.frame.merge(symbolTable, successorBlock.frame, outgoingEdge.info);

代码示例来源:origin: com.bladejava/blade-asm

int catchType = Frame.getAbstractTypeFromInternalName(symbolTable, catchTypeDescriptor);
Label handlerBlock = handler.handlerPc.getCanonicalInstance();
handlerBlock.flags |= Label.FLAG_JUMP_TARGET;
Label handlerRangeBlock = handler.startPc.getCanonicalInstance();
Label handlerRangeEnd = handler.endPc.getCanonicalInstance();
while (handlerRangeBlock != handlerRangeEnd) {
 handlerRangeBlock.outgoingEdges =
 Label successorBlock = outgoingEdge.successor.getCanonicalInstance();
 boolean successorBlockChanged =
   basicBlock.frame.merge(symbolTable, successorBlock.frame, outgoingEdge.info);

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

int catchType = Frame.getAbstractTypeFromInternalName(symbolTable, catchTypeDescriptor);
Label handlerBlock = handler.handlerPc.getCanonicalInstance();
handlerBlock.flags |= Label.FLAG_JUMP_TARGET;
Label handlerRangeBlock = handler.startPc.getCanonicalInstance();
Label handlerRangeEnd = handler.endPc.getCanonicalInstance();
while (handlerRangeBlock != handlerRangeEnd) {
 handlerRangeBlock.outgoingEdges =
 Label successorBlock = outgoingEdge.successor.getCanonicalInstance();
 boolean successorBlockChanged =
   basicBlock.frame.merge(symbolTable, successorBlock.frame, outgoingEdge.info);

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

currentBasicBlock.frame.execute(baseOpcode, 0, null, null);
label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;

代码示例来源:origin: com.bladejava/blade-asm

currentBasicBlock.frame.execute(baseOpcode, 0, null, null);
label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;

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

currentBasicBlock.frame.execute(baseOpcode, 0, null, null);
label.getCanonicalInstance().flags |= Label.FLAG_JUMP_TARGET;

相关文章