de.fub.bytecode.generic
Class InstructionHandle
java.lang.Object
|
+--de.fub.bytecode.generic.InstructionHandle
- Direct Known Subclasses:
- BranchHandle
- public class InstructionHandle
- extends java.lang.Object
- implements java.io.Serializable
Instances of this class give users a handle to the instructions contained in
an InstructionList. Instruction objects may be uesd more than once within a
list, this is useful because it saves memory and may be much faster.
Within an InstructionList an InstructionHandle object is wrapped
around all instructions, i.e. it implements a cell in a
doubly-linked list. From the outside only the next and the
previous instruction (handle) are accessible. One
can traverse the list via an Enumeration returned by
InstructionList.elements().
- Version:
- $Id: InstructionHandle.java,v 1.8 1999/09/09 07:42:53 dahm Exp $
- Author:
- M. Dahm
- See Also:
Enumeration
,
Instruction
,
BranchHandle
,
InstructionList
, Serialized Form
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
i_position
protected int i_position
InstructionHandle
protected InstructionHandle(Instruction i)
getNext
public final InstructionHandle getNext()
getPrev
public final InstructionHandle getPrev()
getInstruction
public final Instruction getInstruction()
setInstruction
public void setInstruction(Instruction i)
- Replace current instruction contained in this handle.
Old instruction is disposed and may not be used anymore.
updatePosition
protected int updatePosition(int offset,
int max_offset)
- Called by InstructionList.setPositions when setting the position for every
instruction. In the presence of variable length instructions `setPositions'
performs multiple passes over the instruction list to calculate the
correct (byte) positions and offsets by calling this function.
- Parameters:
offset
- additional offset caused by preceding (variable length) instructionsmax_offset
- the maximum offset that may be caused by these instructions- Returns:
- additional offset caused by possible change of this instruction's length
addHandle
protected void addHandle()
- Overridden in BranchHandle
removeAllTargeters
public void removeAllTargeters()
- Remove all targeters, if any.
removeTargeter
public void removeTargeter(InstructionTargeter t)
- Denote this handle isn't referenced anymore by t.
addTargeter
public void addTargeter(InstructionTargeter t)
- Denote this handle is being referenced by t.
hasTargeters
public boolean hasTargeters()
getTargeters
public InstructionTargeter[] getTargeters()
- Returns:
- null, if there are no targeters
toString
public java.lang.String toString(boolean verbose)
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object