Class Label

java.lang.Object
mockit.asm.controlFlow.Label

public final class Label extends Object
A label represents a position in the bytecode of a method. Labels are used for jump, goto, and switch instructions, and for try catch blocks. A label designates the instruction that is just after. Note however that there can be other elements between a label and the instruction it designates (such as other labels, stack map frames, line numbers, etc.).
  • Field Details

    • line

      public @NonNegative int line
      The line number corresponding to this label, if known.
    • jumpTargetLine

      public @NonNegative int jumpTargetLine
      Line number of label which is the target of a JMP instruction.
    • position

      public @NonNegative int position
      The position of this label in the code, if known.
  • Constructor Details

    • Label

      public Label()
  • Method Details

    • getFrame

      public Frame getFrame()
      Returns the frame this basic block belongs to, if any.
    • isDebug

      public boolean isDebug()
    • isResolved

      public boolean isResolved()
    • isTarget

      public boolean isTarget()
    • isStoringFrame

      public boolean isStoringFrame()
    • isReachable

      public boolean isReachable()
    • markAsDebug

      public void markAsDebug()
    • markAsTarget

      public void markAsTarget()
    • put

      public void put(@NonNull ByteVector out, @NonNegative int source, boolean wideOffset)
      Puts a reference to this label in the bytecode of a method. If the position of the label is known, the offset is computed and written directly. Otherwise, a null offset is written and a new forward reference is declared for this label.
      Parameters:
      out - the bytecode of the method
      source - the position of first byte of the bytecode instruction that contains this label
      wideOffset - true if the reference must be stored in 4 bytes, or false if it must be stored with 2 bytes
      Throws:
      IllegalArgumentException - if this label has not been created by the given code writer
    • getFirst

      @NonNull public Label getFirst()
      Returns the first label of the series to which this label belongs. For an isolated label or for the first label in a series of successive labels, returns the label itself. For other labels, returns the first label of the series.
      Returns:
      the first label of the series to which this label belongs
    • getSuccessor

      @Nullable public Label getSuccessor()
      Returns this label's successor, if any.
    • setSuccessors

      @Nullable public Label setSuccessors(@NonNull Edge edge)
    • toString

      public String toString()
      Overrides:
      toString in class Object