public class InstructionHandle extends Object implements Serializable
Instruction
,
BranchHandle
,
InstructionList
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int |
i_position |
Modifier | Constructor and Description |
---|---|
protected |
InstructionHandle(Instruction i) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor v)
Convenience method, simply calls accept() on the contained instruction.
|
void |
addAttribute(Object key,
Object attr)
Add an attribute to an instruction handle.
|
protected void |
addHandle()
Overridden in BranchHandle
|
void |
addTargeter(InstructionTargeter t)
Denote this handle is being referenced by t.
|
Object |
getAttribute(Object key)
Get attribute of an instruction handle.
|
Collection<Object> |
getAttributes() |
Instruction |
getInstruction() |
InstructionHandle |
getNext() |
int |
getPosition() |
InstructionHandle |
getPrev() |
InstructionTargeter[] |
getTargeters() |
boolean |
hasTargeters() |
void |
removeAllTargeters()
Remove all targeters, if any.
|
void |
removeAttribute(Object key)
Delete an attribute of an instruction handle.
|
void |
removeTargeter(InstructionTargeter t)
Denote this handle isn't referenced anymore by t.
|
void |
setInstruction(Instruction i)
Replace current instruction contained in this handle.
|
Instruction |
swapInstruction(Instruction i)
Temporarily swap the current instruction, without disturbing
anything.
|
String |
toString() |
String |
toString(boolean verbose) |
protected int |
updatePosition(int offset,
int max_offset)
Called by InstructionList.setPositions when setting the position for every
instruction.
|
protected InstructionHandle(Instruction i)
public final InstructionHandle getNext()
public final InstructionHandle getPrev()
public final Instruction getInstruction()
public void setInstruction(Instruction i)
public Instruction swapInstruction(Instruction i)
protected int updatePosition(int offset, int max_offset)
offset
- additional offset caused by preceding (variable length) instructionsmax_offset
- the maximum offset that may be caused by these instructionspublic int getPosition()
protected void addHandle()
public void removeAllTargeters()
public void removeTargeter(InstructionTargeter t)
public void addTargeter(InstructionTargeter t)
public boolean hasTargeters()
public InstructionTargeter[] getTargeters()
public String toString(boolean verbose)
public String toString()
public void addAttribute(Object key, Object attr)
key
- the key object to store/retrieve the attributeattr
- the attribute to associate with this handlepublic void removeAttribute(Object key)
key
- the key object to retrieve the attributepublic Object getAttribute(Object key)
key
- the key object to store/retrieve the attributepublic Collection<Object> getAttributes()
public void accept(Visitor v)
v
- Visitor object