public class InstructionHandle
extends java.lang.Object
Instruction
,
BranchHandle
,
InstructionList
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Object,java.lang.Object> |
attributes |
protected int |
i_position
Deprecated.
(since 6.0) will be made private; do not access directly, use getter/setter
|
private Instruction |
instruction |
private InstructionHandle |
next |
private InstructionHandle |
prev |
private java.util.Set<InstructionTargeter> |
targeters |
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(java.lang.Object key,
java.lang.Object attr)
Add an attribute to an instruction handle.
|
protected void |
addHandle()
Deprecated.
Does nothing as of 6.3.1.
|
void |
addTargeter(InstructionTargeter t)
Denote this handle is being referenced by t.
|
(package private) void |
dispose()
Delete contents, i.e., remove user access.
|
java.lang.Object |
getAttribute(java.lang.Object key)
Get attribute of an instruction handle.
|
java.util.Collection<java.lang.Object> |
getAttributes() |
Instruction |
getInstruction() |
(package private) static InstructionHandle |
getInstructionHandle(Instruction i)
Factory method.
|
InstructionHandle |
getNext() |
int |
getPosition() |
InstructionHandle |
getPrev() |
InstructionTargeter[] |
getTargeters() |
boolean |
hasTargeters() |
void |
removeAllTargeters()
Remove all targeters, if any.
|
void |
removeAttribute(java.lang.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.
|
(package private) InstructionHandle |
setNext(InstructionHandle next) |
(package private) void |
setPosition(int pos)
Set the position, i.e., the byte code offset of the contained
instruction.
|
(package private) InstructionHandle |
setPrev(InstructionHandle prev) |
Instruction |
swapInstruction(Instruction i)
Temporarily swap the current instruction, without disturbing
anything.
|
java.lang.String |
toString() |
java.lang.String |
toString(boolean verbose) |
protected int |
updatePosition(int offset,
int max_offset)
Called by InstructionList.setPositions when setting the position for every
instruction.
|
private InstructionHandle next
private InstructionHandle prev
private Instruction instruction
@Deprecated protected int i_position
private java.util.Set<InstructionTargeter> targeters
private java.util.Map<java.lang.Object,java.lang.Object> attributes
protected InstructionHandle(Instruction i)
@Deprecated protected void addHandle()
public final InstructionHandle getNext()
public final InstructionHandle getPrev()
public final Instruction getInstruction()
public void setInstruction(Instruction i)
public Instruction swapInstruction(Instruction i)
Warning: if this is used on a BranchHandle then some methods such as getPosition() will still refer to the original cached instruction, whereas other BH methods may affect the cache and the replacement instruction.
static InstructionHandle getInstructionHandle(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()
void setPosition(int pos)
void dispose()
public void removeAllTargeters()
public void removeTargeter(InstructionTargeter t)
public void addTargeter(InstructionTargeter t)
public boolean hasTargeters()
public InstructionTargeter[] getTargeters()
public java.lang.String toString(boolean verbose)
public java.lang.String toString()
toString
in class java.lang.Object
public void addAttribute(java.lang.Object key, java.lang.Object attr)
key
- the key object to store/retrieve the attributeattr
- the attribute to associate with this handlepublic void removeAttribute(java.lang.Object key)
key
- the key object to retrieve the attributepublic java.lang.Object getAttribute(java.lang.Object key)
key
- the key object to store/retrieve the attributepublic java.util.Collection<java.lang.Object> getAttributes()
public void accept(Visitor v)
v
- Visitor objectfinal InstructionHandle setNext(InstructionHandle next)
next
- the next to setfinal InstructionHandle setPrev(InstructionHandle prev)
prev
- the prev to set