| java.lang.Object org.objectweb.asm.Label
Label | public class Label (Code) | | 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.
author: Eric Bruneton |
Field Summary | |
final static int | DEBUG Indicates if this label is only used for debug attributes. | final static int | PUSHED Indicates if this basic block has been pushed in the basic block stack. | final static int | REACHABLE Indicates if this label corresponds to a reachable basic block. | final static int | RESIZED Indicates if this label has been updated, after instruction resizing. | final static int | RESOLVED Indicates if the position of this label is known. | final static int | STORE Indicates if a stack map frame must be stored for this label. | final static int | TARGET Indicates if this label is the target of a jump instruction, or the start
of an exception handler. | Frame | frame Information about the input and output stack map frames of this basic
block. | public Object | info Field used to associate user information to a label. | int | inputStackTop Start of the output stack relatively to the input stack. | int | line The line number corresponding to this label, if known. | Label | next The next basic block in the basic block stack. | int | outputStackMax Maximum height reached by the output stack, relatively to the top of the
input stack. | int | position The position of this label in the code, if known. | int | status Flags that indicate the status of this label. | Label | successor The successor of this label, in the order they are visited. | Edge | successors The successors of this node in the control flow graph. |
Constructor Summary | |
public | Label() Constructs a new label. | | Label(boolean debug) Constructs a new label. |
Method Summary | |
Label | getFirst() Returns the first label of the series to which this label belongs. | public int | getOffset() Returns the offset corresponding to this label. | void | put(MethodWriter owner, ByteVector out, int source, boolean wideOffset) Puts a reference to this label in the bytecode of a method. | boolean | resolve(MethodWriter owner, int position, byte[] data) Resolves all forward references to this label. | public String | toString() Returns a string representation of this label. |
DEBUG | final static int DEBUG(Code) | | Indicates if this label is only used for debug attributes. Such a label
is not the start of a basic block, the target of a jump instruction, or
an exception handler. It can be safely ignored in control flow graph
analysis algorithms (for optimization purposes).
|
PUSHED | final static int PUSHED(Code) | | Indicates if this basic block has been pushed in the basic block stack.
See
MethodWriter.visitMaxs visitMaxs .
|
REACHABLE | final static int REACHABLE(Code) | | Indicates if this label corresponds to a reachable basic block.
|
RESIZED | final static int RESIZED(Code) | | Indicates if this label has been updated, after instruction resizing.
|
RESOLVED | final static int RESOLVED(Code) | | Indicates if the position of this label is known.
|
STORE | final static int STORE(Code) | | Indicates if a stack map frame must be stored for this label.
|
TARGET | final static int TARGET(Code) | | Indicates if this label is the target of a jump instruction, or the start
of an exception handler.
|
info | public Object info(Code) | | Field used to associate user information to a label.
|
inputStackTop | int inputStackTop(Code) | | Start of the output stack relatively to the input stack. The exact
semantics of this field depends on the algorithm that is used.
When only the maximum stack size is computed, this field is the number of
elements in the input stack, plus one. Basic blocks that have never been
visited have a null inputStackTop, and can therefore be distinguished
from labels whose inputStackTop has already been computed.
When the stack map frames are completely computed, this field is the
offset of the first output stack element relatively to the top of the
input stack. This offset is always negative or null. A null offset means
that the output stack must be appended to the input stack. A -n offset
means that the first n output stack elements must replace the top n input
stack elements, and that the other elements must be appended to the input
stack.
|
line | int line(Code) | | The line number corresponding to this label, if known.
|
next | Label next(Code) | | The next basic block in the basic block stack. This stack is used in the
main loop of the fix point algorithm used in the second step of the
control flow analysis algorithms.
See Also: MethodWriter.visitMaxs |
outputStackMax | int outputStackMax(Code) | | Maximum height reached by the output stack, relatively to the top of the
input stack. This maximum is always positive or null.
|
position | int position(Code) | | The position of this label in the code, if known.
|
successor | Label successor(Code) | | The successor of this label, in the order they are visited. This linked
list does not include labels used for debug info only, nor successive
labels that denote the same bytecode position (in this case only the
first label appears in this list).
|
successors | Edge successors(Code) | | The successors of this node in the control flow graph. These successors
are stored in a linked list of
Edge Edge objects, linked to each
other by their
Edge.next field.
|
Label | public Label()(Code) | | Constructs a new label.
|
Label | Label(boolean debug)(Code) | | Constructs a new label.
Parameters: debug - if this label is only used for debug attributes. |
getFirst | Label getFirst()(Code) | | 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,
this method returns the label itself. For other labels it returns the
first label of the series.
the first label of the series to which this label belongs. |
getOffset | public int getOffset()(Code) | | Returns the offset corresponding to this label. This offset is computed
from the start of the method's bytecode. This method is intended for
Attribute sub classes, and is normally not needed by class
generators or adapters.
the offset corresponding to this label. throws: IllegalStateException - if this label is not resolved yet. |
put | void put(MethodWriter owner, ByteVector out, int source, boolean wideOffset)(Code) | | 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: owner - the code writer that calls this method. Parameters: out - the bytecode of the method. Parameters: source - the position of first byte of the bytecode instruction thatcontains this label. Parameters: wideOffset - true if the reference must be stored in 4bytes, or false if it must be stored with 2 bytes. throws: IllegalArgumentException - if this label has not been created bythe given code writer. |
resolve | boolean resolve(MethodWriter owner, int position, byte[] data)(Code) | | Resolves all forward references to this label. This method must be called
when this label is added to the bytecode of the method, i.e. when its
position becomes known. This method fills in the blanks that where left
in the bytecode by each forward reference previously added to this label.
Parameters: owner - the code writer that calls this method. Parameters: position - the position of this label in the bytecode. Parameters: data - the bytecode of the method. true if a blank that was left for this label was tosmall to store the offset. In such a case the corresponding jumpinstruction is replaced with a pseudo instruction (using unusedopcodes) using an unsigned two bytes offset. These pseudoinstructions will need to be replaced with true instructions withwider offsets (4 bytes instead of 2). This is done inMethodWriter.resizeInstructions. throws: IllegalArgumentException - if this label has already been resolved,or if it has not been created by the given code writer. |
toString | public String toString()(Code) | | Returns a string representation of this label.
a string representation of this label. |
|
|