| java.lang.Object net.sf.retrotranslator.runtime.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 | |
int | beginStackSize The stack size at the beginning of this basic block. | int | line The line number corresponding to this label, if known. | int | maxStackSize The (relative) maximum stack size corresponding to this basic block. | Label | next The next basic block in the basic block stack. | int | position The position of this label in the code, if known. | boolean | pushed true if this basic block has been pushed in the basic block
stack. | boolean | resized If the label position has been updated, after instruction resizing. | boolean | resolved Indicates if the position of this label is known. | Edge | successors The successors of this node in the control flow graph. |
Constructor Summary | |
public | Label() Constructs a new label. |
Method Summary | |
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. |
beginStackSize | int beginStackSize(Code) | | The stack size at the beginning of this basic block. This size is
initially unknown. It is computed by the control flow analysis algorithm
(see
MethodWriter.visitMaxs visitMaxs ).
|
line | int line(Code) | | The line number corresponding to this label, if known.
|
maxStackSize | int maxStackSize(Code) | | The (relative) maximum stack size corresponding to this basic block. This
size is relative to the stack size at the beginning of the basic block,
i.e., the true maximum stack size is equal to
Label.beginStackSizebeginStackSize +
Label.maxStackSize maxStackSize .
|
position | int position(Code) | | The position of this label in the code, if known.
|
resized | boolean resized(Code) | | If the label position has been updated, after instruction resizing.
|
resolved | boolean resolved(Code) | | Indicates if the position of this label is known.
|
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.
|
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. |
|
|