public class Label extends Object
| 限定符和类型 | 字段和说明 | 
|---|---|
| (专用程序包) int | bytecodeOffsetThe offset of this label in the bytecode of its method, in bytes. | 
| (专用程序包) static Label | EMPTY_LISTA sentinel element used to indicate the end of a list of labels. | 
| (专用程序包) static int | FLAG_DEBUG_ONLYA flag indicating that a label is only used for debug attributes. | 
| (专用程序包) static int | FLAG_JUMP_TARGETA flag indicating that a label is the target of a jump instruction, or the start of an
 exception handler. | 
| (专用程序包) static int | FLAG_REACHABLEA flag indicating that a label corresponds to a reachable basic block. | 
| (专用程序包) static int | FLAG_RESOLVEDA flag indicating that the bytecode offset of a label is known. | 
| (专用程序包) static int | FLAG_SUBROUTINE_CALLERA flag indicating that the basic block corresponding to a label ends with a subroutine call. | 
| (专用程序包) static int | FLAG_SUBROUTINE_ENDA flag indicating that the basic block corresponding to a label is the end of a subroutine. | 
| (专用程序包) static int | FLAG_SUBROUTINE_STARTA flag indicating that the basic block corresponding to a label is the start of a subroutine. | 
| (专用程序包) short | flagsThe type and status of this label or its corresponding basic block. | 
| (专用程序包) static int | FORWARD_REFERENCE_HANDLE_MASKThe bit mask to extract the 'handle' of a forward reference to this label. | 
| (专用程序包) static int | FORWARD_REFERENCE_TYPE_MASKThe bit mask to extract the type of a forward reference to this label. | 
| (专用程序包) static int | FORWARD_REFERENCE_TYPE_SHORTThe type of forward references stored with two bytes in the bytecode. | 
| (专用程序包) static int | FORWARD_REFERENCE_TYPE_WIDEThe type of forward references stored in four bytes in the bytecode. | 
| (专用程序包) static int | FORWARD_REFERENCES_CAPACITY_INCREMENTThe number of elements to add to the  forwardReferencesarray when it needs to be
 resized to store a new forward reference. | 
| private int[] | forwardReferencesThe forward references to this label. | 
| (专用程序包) Frame | frameThe input and output stack map frames of the basic block corresponding to this label. | 
| Object | infoA user managed state associated with this label. | 
| (专用程序包) short | inputStackSizeThe number of elements in the input stack of the basic block corresponding to this label. | 
| (专用程序包) static int | LINE_NUMBERS_CAPACITY_INCREMENTThe number of elements to add to the  otherLineNumbersarray when it needs to be
 resized to store a new source line number. | 
| private short | lineNumberThe source line number corresponding to this label, or 0. | 
| (专用程序包) Label | nextBasicBlockThe successor of this label, in the order they are visited in  MethodVisitor.visitLabel(com.fastchar.asm.org.objectweb.Label). | 
| (专用程序包) Label | nextListElementThe next element in the list of labels to which this label belongs, or null if it
 does not belong to any list. | 
| private int[] | otherLineNumbersThe source line numbers corresponding to this label, in addition to  lineNumber, or
 null. | 
| (专用程序包) Edge | outgoingEdgesThe outgoing edges of the basic block corresponding to this label, in the control flow graph of
 its method. | 
| (专用程序包) short | outputStackMaxThe maximum height reached by the output stack, relatively to the top of the input stack, in
 the basic block corresponding to this label. | 
| (专用程序包) short | outputStackSizeThe number of elements in the output stack, at the end of the basic block corresponding to this
 label. | 
| (专用程序包) short | subroutineIdThe id of the subroutine to which this basic block belongs, or 0. | 
| 构造器和说明 | 
|---|
| Label()Constructs a new label. | 
| 限定符和类型 | 方法和说明 | 
|---|---|
| (专用程序包) void | accept(MethodVisitor methodVisitor,
      boolean visitLineNumbers)Makes the given visitor visit this label and its source line numbers, if applicable. | 
| private void | addForwardReference(int sourceInsnBytecodeOffset,
                   int referenceType,
                   int referenceHandle)Adds a forward reference to this label. | 
| (专用程序包) void | addLineNumber(int lineNumber)Adds a source line number corresponding to this label. | 
| (专用程序包) void | addSubroutineRetSuccessors(Label subroutineCaller)Finds the basic blocks that end a subroutine starting with the basic block corresponding to
 this label and, for each one of them, adds an outgoing edge to the basic block following the
 given subroutine call. | 
| (专用程序包) Label | getCanonicalInstance()Returns the "canonical"  Labelinstance corresponding to this label's bytecode offset,
 if known, otherwise the label itself. | 
| int | getOffset()Returns the bytecode offset corresponding to this label. | 
| (专用程序包) void | markSubroutine(short subroutineId)Finds the basic blocks that belong to the subroutine starting with the basic block
 corresponding to this label, and marks these blocks as belonging to this subroutine. | 
| private Label | pushSuccessors(Label listOfLabelsToProcess)Adds the successors of this label in the method's control flow graph (except those
 corresponding to a jsr target, and those already in a list of labels) to the given list of
 blocks to process, and returns the new list. | 
| (专用程序包) void | put(ByteVector code,
   int sourceInsnBytecodeOffset,
   boolean wideReference)Puts a reference to this label in the bytecode of a method. | 
| (专用程序包) boolean | resolve(byte[] code,
       int bytecodeOffset)Sets the bytecode offset of this label to the given value and resolves the forward references
 to this label, if any. | 
| String | toString()Returns a string representation of this label. | 
static final int FLAG_DEBUG_ONLY
static final int FLAG_JUMP_TARGET
static final int FLAG_RESOLVED
static final int FLAG_REACHABLE
static final int FLAG_SUBROUTINE_CALLER
MethodWriter.visitJumpInsn(int, com.fastchar.asm.org.objectweb.Label), labels with this flag set have at least two
 outgoing edges:
 addSubroutineRetSuccessors(com.fastchar.asm.org.objectweb.Label).
   static final int FLAG_SUBROUTINE_START
static final int FLAG_SUBROUTINE_END
static final int LINE_NUMBERS_CAPACITY_INCREMENT
otherLineNumbers array when it needs to be
 resized to store a new source line number.static final int FORWARD_REFERENCES_CAPACITY_INCREMENT
forwardReferences array when it needs to be
 resized to store a new forward reference.static final int FORWARD_REFERENCE_TYPE_MASK
FORWARD_REFERENCE_TYPE_SHORT or FORWARD_REFERENCE_TYPE_WIDE.forwardReferences, 
常量字段值static final int FORWARD_REFERENCE_TYPE_SHORT
static final int FORWARD_REFERENCE_TYPE_WIDE
static final int FORWARD_REFERENCE_HANDLE_MASK
FORWARD_REFERENCE_TYPE_MASK).forwardReferences, 
常量字段值static final Label EMPTY_LIST
nextListElementpublic Object info
short flags
FLAG_DEBUG_ONLY, FLAG_JUMP_TARGET, FLAG_RESOLVED, FLAG_REACHABLE, FLAG_SUBROUTINE_CALLER, FLAG_SUBROUTINE_START, FLAG_SUBROUTINE_END.private short lineNumber
otherLineNumbers.private int[] otherLineNumbers
lineNumber, or
 null. The first element of this array is the number n of source line numbers it contains, which
 are stored between indices 1 and n (inclusive).int bytecodeOffset
FLAG_RESOLVED flag is set.private int[] forwardReferences
FORWARD_REFERENCE_TYPE_MASK
       and FORWARD_REFERENCE_HANDLE_MASK.
 For instance, for an ifnull instruction at bytecode offset x, 'sourceInsnBytecodeOffset' is
 equal to x, and 'reference' is of type FORWARD_REFERENCE_TYPE_SHORT with value x + 1
 (because the ifnull instruction uses a 2 bytes bytecode offset operand stored one byte after
 the start of the instruction itself). For the default case of a lookupswitch instruction at
 bytecode offset x, 'sourceInsnBytecodeOffset' is equal to x, and 'reference' is of type FORWARD_REFERENCE_TYPE_WIDE with value between x + 1 and x + 4 (because the lookupswitch
 instruction uses a 4 bytes bytecode offset operand stored one to four bytes after the start of
 the instruction itself).
short inputStackSize
MethodWriter.computeMaxStackAndLocal().short outputStackSize
short outputStackMax
short subroutineId
MethodWriter.computeMaxStackAndLocal(), if the method contains JSR
 instructions.Frame frame
MethodWriter.COMPUTE_ALL_FRAMES or MethodWriter.COMPUTE_INSERTED_FRAMES option is used.Label nextBasicBlock
MethodVisitor.visitLabel(com.fastchar.asm.org.objectweb.Label).
 This linked list does not include labels used for debug info only. If the MethodWriter.COMPUTE_ALL_FRAMES or MethodWriter.COMPUTE_INSERTED_FRAMES option is used
 then it does not contain either successive labels that denote the same bytecode offset (in this
 case only the first label appears in this list).Edge outgoingEdges
Edge objects, linked to each
 other by their Edge.nextEdge field.Label nextListElement
EMPTY_LIST
 sentinel, in order to ensure that this field is null if and only if this label does not belong
 to a list of labels. Note that there can be several lists of labels at the same time, but that
 a label can belong to at most one list at a time (unless some lists share a common tail, but
 this is not used in practice).
 List of labels are used in MethodWriter.computeAllFrames() and MethodWriter.computeMaxStackAndLocal() to compute stack map frames and the maximum stack size,
 respectively, as well as in markSubroutine(short) and addSubroutineRetSuccessors(com.fastchar.asm.org.objectweb.Label) to
 compute the basic blocks belonging to subroutines and their outgoing edges. Outside of these
 methods, this field should be null (this property is a precondition and a postcondition of
 these methods).
public int getOffset()
Attribute sub classes, and is
 normally not needed by class generators or adapters.IllegalStateException - if this label is not resolved yet.final Label getCanonicalInstance()
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(com.fastchar.asm.org.objectweb.Label)) 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.
frame is null, otherwise the Label's frame owner. This
     corresponds to the "canonical" label instance described above thanks to the way the label
     frame is set in MethodWriter.visitLabel(com.fastchar.asm.org.objectweb.Label).final void addLineNumber(int lineNumber)
lineNumber - a source line number (which should be strictly positive).final void accept(MethodVisitor methodVisitor, boolean visitLineNumbers)
methodVisitor - a method visitor.visitLineNumbers - whether to visit of the label's source line numbers, if any.final void put(ByteVector code, int sourceInsnBytecodeOffset, boolean wideReference)
code - the bytecode of the method. This is where the reference is appended.sourceInsnBytecodeOffset - the bytecode offset of the instruction that contains the
     reference to be appended.wideReference - whether the reference must be stored in 4 bytes (instead of 2 bytes).private void addForwardReference(int sourceInsnBytecodeOffset,
                                 int referenceType,
                                 int referenceHandle)
sourceInsnBytecodeOffset - the bytecode offset of the instruction that contains the
     reference stored at referenceHandle.referenceType - either FORWARD_REFERENCE_TYPE_SHORT or FORWARD_REFERENCE_TYPE_WIDE.referenceHandle - the offset in the bytecode where the forward reference value must be
     stored.final boolean resolve(byte[] code,
                      int bytecodeOffset)
code - the bytecode of the method.bytecodeOffset - the bytecode offset of this label.final void markSubroutine(short subroutineId)
Note: a precondition and postcondition of this method is that all labels must have a null
 nextListElement.
subroutineId - the id of the subroutine starting with the basic block corresponding to
     this label.final void addSubroutineRetSuccessors(Label subroutineCaller)
Note: a precondition and postcondition of this method is that all labels must have a null
 nextListElement.
subroutineCaller - a basic block that ends with a jsr to the basic block corresponding to
     this label. This label is supposed to correspond to the start of a subroutine.private Label pushSuccessors(Label listOfLabelsToProcess)
listOfLabelsToProcess - a list of basic blocks to process, linked together with their
     nextListElement field.Copyright © 2021. All rights reserved.