|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.claritysys.jvm.builder.Label
public final class Label
A label marks a point in the byte[] for branch instruction targets, and allows for forward references to be resolved later.
| Constructor Summary | |
|---|---|
Label(ByteArray code)
Create a new label over the given byte array, but do not define it yet. |
|
| Method Summary | |
|---|---|
void |
define()
Define the label to be equal to the current PC. |
int |
getOffset(boolean isWide)
Return the offset to write to the byte[] from the given offset, depending on whether a short or int offset is needed, in order to branch to this label from the current PC location. |
boolean |
hasFixups()
Returns true if there are unresolved references to this label. |
boolean |
isDefined()
Return true if the label has already been defined. |
Label |
next()
Get the next label in the chain. |
void |
setPC(int pc)
Set the PC of the label. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Label(ByteArray code)
| Method Detail |
|---|
public int getOffset(boolean isWide)
If the label is defined, it returns the offset from the current PC (of course).
If NOT defined, it returns a backpatch address, which will be fixed when the label is defined.
When generating branch instructions, be sure to call this BEFORE adding the branch opcode, which will change the PC and cause this to return an incorrect offset.
public boolean hasFixups()
public Label next()
public boolean isDefined()
public void define()
public void setPC(int pc)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||