|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.java.Bytecode | +--edu.wisc.cs.java.CodeLabel
Instances of this class represent labels in the bytecode. Any branch or jump instruction may have a label as a target. Additionally, try/catch blocks are marked with labels. A label must have a unique ID string within a method. The byte offset of the label is resolved computed when a classfile is written. Since each CodeLabel has a unique ID, it is sufficient in most cases to compare only the references for distinguishing one label from another. Note that there may be two or more labels at the same program counter within a method, so that destinguishing labels is not sufficient to destinguish program points.
Field Summary | |
protected java.lang.String |
ID
Stores the label's ID string. |
Fields inherited from class edu.wisc.cs.java.Bytecode |
opcode,
params,
wide |
Constructor Summary | |
CodeLabel()
Creates a new label with the next identifier in the sequence. |
|
CodeLabel(int pc)
Creates a new Label with the next ID in the sequence. |
|
CodeLabel(java.lang.String prefix)
Creates a new label and constructs its ID from the specified prefix. |
|
CodeLabel(java.lang.String prefix,
int pc)
Creates a new label with an initial program counter value and constructs an ID from the specified prefix. |
Method Summary | |
boolean |
equals(CodeLabel cl)
Returns true if and only if the two labels have the same identifier. |
java.lang.String |
getID()
Returns the string which is the identifier for this label. |
int |
getNBytes()
Returns zero. |
protected static java.lang.String |
getNextLabel()
Returns the next label in the sequence. |
int |
getParamBytes()
Returns zero. |
int |
getTargetPC()
Returns the byte index of the branch target, as read from a classfile. |
void |
setTargetPC(int pc)
Sets a new target pc. |
java.lang.String |
toString()
Returns a string representation of a label object. |
void |
writeTo(java.io.DataOutputStream out)
This method does nothing. |
Methods inherited from class edu.wisc.cs.java.Bytecode |
getConstantIndex,
getOpcode,
isWide |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected final java.lang.String ID
Constructor Detail |
public CodeLabel()
public CodeLabel(java.lang.String prefix)
prefix
- a prefix to use as part of the ID string.pc
- the initial position of this label in the bytecode.public CodeLabel(int pc)
pc
- the initial position of this label in the bytecode.public CodeLabel(java.lang.String prefix, int pc)
prefix
- a prefix to use as part of the ID string.pc
- the initial position of this label in the bytecode.Method Detail |
protected static java.lang.String getNextLabel()
public java.lang.String getID()
public java.lang.String toString()
public boolean equals(CodeLabel cl)
public int getTargetPC()
public void setTargetPC(int pc)
pc
- a new target pc.public int getNBytes()
public int getParamBytes()
public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
out
- a stream to write nothing to.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |