public class InstructionHandle extends Object
Instruction
,
BranchHandle
,
InstructionList
Modifier and Type | Field and Description |
---|---|
static InstructionHandle[] |
EMPTY_ARRAY
Empty array.
|
protected int |
i_position
Deprecated.
(since 6.0) will be made private; do not access directly, use getter/setter
|
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()
Deprecated.
Does nothing as of 6.3.1.
|
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 maxOffset)
Called by InstructionList.setPositions when setting the position for every instruction.
|
public static final InstructionHandle[] EMPTY_ARRAY
@Deprecated protected int i_position
protected InstructionHandle(Instruction i)
public void accept(Visitor v)
v
- Visitor objectpublic void addAttribute(Object key, Object attr)
key
- the key object to store/retrieve the attributeattr
- the attribute to associate with this handle@Deprecated protected void addHandle()
public void addTargeter(InstructionTargeter t)
public Object getAttribute(Object key)
key
- the key object to store/retrieve the attributepublic Collection<Object> getAttributes()
public final Instruction getInstruction()
public final InstructionHandle getNext()
public int getPosition()
public final InstructionHandle getPrev()
public InstructionTargeter[] getTargeters()
public boolean hasTargeters()
public void removeAllTargeters()
public void removeAttribute(Object key)
key
- the key object to retrieve the attributepublic void removeTargeter(InstructionTargeter t)
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.
public String toString()
public String toString(boolean verbose)
protected int updatePosition(int offset, int maxOffset)
offset
- additional offset caused by preceding (variable length) instructionsmaxOffset
- the maximum offset that may be caused by these instructionsCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.