Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

InstructionHandle Class Reference

Inheritance diagram for InstructionHandle:
[legend]
Collaboration diagram for InstructionHandle:
[legend]
List of all members.

Public Methods

void addTargeter (InstructionTargeter t)
final Instruction getInstruction ()
final InstructionHandle getNext ()
int getPosition ()
final InstructionHandle getPrev ()
InstructionTargeter[] getTargeters ()
boolean hasTargeters ()
void removeAllTargeters ()
void removeTargeter (InstructionTargeter t)
void setInstruction (Instruction i)
String toString ()
String toString (boolean verbose)
void accept (Visitor v)
void addAttribute (Object key, Object attr)
void addTargeter (InstructionTargeter t)
Object getAttribute (Object key)
final Instruction getInstruction ()
final InstructionHandle getNext ()
int getPosition ()
final InstructionHandle getPrev ()
InstructionTargeter[] getTargeters ()
boolean hasTargeters ()
void removeAllTargeters ()
void removeAttribute (Object key)
void removeTargeter (InstructionTargeter t)
void setInstruction (Instruction i)
Instruction swapInstruction (Instruction i)
String toString ()
String toString (boolean verbose)

Protected Methods

 InstructionHandle (Instruction i)
void addHandle ()
int updatePosition (int offset, int max_offset)
 InstructionHandle (Instruction i)
void addHandle ()
int updatePosition (int offset, int max_offset)

Protected Attributes

int i_position = -1

Private Methods

void dispose ()
void setPosition (int pos)
void dispose ()
void setPosition (int pos)

Static Private Methods

final InstructionHandle getInstructionHandle (Instruction i)
final InstructionHandle getInstructionHandle (Instruction i)

Private Attributes

InstructionHandle next
InstructionHandle prev
Instruction instruction
Vector targeters
Hashtable attributes

Static Private Attributes

InstructionHandle ih_list = null

Detailed Description

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.1.1.1 2002/01/24 03:44:03 pserver Exp
Author:
M. Dahm
See also:
java.util.Enumeration , Instruction , BranchHandle , InstructionList

Definition at line 25 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.


Member Function Documentation

void InstructionHandle::accept Visitor   v [inline]
 

Convenience method, simply calls accept() on the contained instruction.

Parameters:
v   Visitor object

Definition at line 41 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::addAttribute Object   key,
Object   attr
[inline]
 

Add an attribute to an instruction handle.

Parameters:
key   the key object to store/retrieve the attribute
attr   the attribute to associate with this handle

Definition at line 49 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::addHandle   [inline, protected]
 

Overridden in BranchHandle

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 57 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::addHandle   [inline, protected]
 

Overridden in BranchHandle

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 40 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::addTargeter InstructionTargeter   t [inline]
 

Denote this handle is being referenced by t.

Definition at line 64 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::addTargeter InstructionTargeter   t [inline]
 

Denote this handle is being referenced by t.

Definition at line 47 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by BranchInstruction::notifyTarget().

void InstructionHandle::dispose   [inline, private]
 

Delete contents, i.e., remove user access and make handle reusable.

Definition at line 74 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::dispose   [inline, private]
 

Delete contents, i.e. remove user access and make handle reusable.

Definition at line 57 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by InstructionList::dispose(), and InstructionList::remove().

Object InstructionHandle::getAttribute Object   key [inline]
 

Get attribute of an instruction handle.

Parameters:
key   the key object to store/retrieve the attribute

Definition at line 87 of file src/de/fub/bytecode/generic/InstructionHandle.java.

final InstructionHandle InstructionHandle::getInstructionHandle Instruction   i [inline, static, private]
 

Factory method.

Definition at line 96 of file src/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by InstructionList::insert().

int InstructionHandle::getPosition   [inline]
 

Returns:
the position, i.e., the byte code offset of the contained instruction. This is accurate only after InstructionList.setPositions() has been called.

Definition at line 113 of file src/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by CodeExceptionGen::getCodeException(), LineNumberGen::getLineNumber(), LocalVariableGen::getLocalVariable(), and BranchInstruction::getTargetOffset().

InstructionTargeter [] InstructionHandle::getTargeters   [inline]
 

Returns:
null, if there are no targeters

Definition at line 118 of file src/de/fub/bytecode/generic/InstructionHandle.java.

InstructionTargeter [] InstructionHandle::getTargeters   [inline]
 

Returns:
null, if there are no targeters

Definition at line 86 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::removeAllTargeters   [inline]
 

Remove all targeters, if any.

Definition at line 131 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::removeAllTargeters   [inline]
 

Remove all targeters, if any.

Definition at line 99 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::removeAttribute Object   key [inline]
 

Delete an attribute of an instruction handle.

Parameters:
key   the key object to retrieve the attribute

Definition at line 139 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::removeTargeter InstructionTargeter   t [inline]
 

Denote this handle isn't referenced anymore by t.

Definition at line 146 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::removeTargeter InstructionTargeter   t [inline]
 

Denote this handle isn't referenced anymore by t.

Definition at line 106 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by Select::dispose(), and BranchInstruction::notifyTarget().

void InstructionHandle::setInstruction Instruction   i [inline]
 

Replace current instruction contained in this handle. Old instruction is disposed using Instruction.dispose().

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 153 of file src/de/fub/bytecode/generic/InstructionHandle.java.

void InstructionHandle::setInstruction Instruction   i [inline]
 

Replace current instruction contained in this handle. Old instruction is disposed using Instruction.dispose().

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 113 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by getInstructionHandle().

void InstructionHandle::setPosition int   pos [inline, private]
 

Set the position, i.e., the byte code offset of the contained instruction.

Definition at line 168 of file src/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by InstructionList::InstructionList(), and InstructionList::setPositions().

Instruction InstructionHandle::swapInstruction Instruction   i [inline]
 

Temporarily swap the current instruction, without disturbing anything. Meant to be used by a debugger, implementing breakpoints. Current instruction is returned.

Definition at line 174 of file src/de/fub/bytecode/generic/InstructionHandle.java.

String InstructionHandle::toString boolean   verbose [inline]
 

Returns:
a (verbose) string representation of the contained instruction.

Definition at line 186 of file src/de/fub/bytecode/generic/InstructionHandle.java.

String InstructionHandle::toString   [inline]
 

Returns:
a string representation of the contained instruction.

Definition at line 181 of file src/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by InstructionList::remove(), and InstructionList::toString().

int InstructionHandle::updatePosition int   offset,
int   max_offset
[inline, protected]
 

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) instructions
max_offset   the maximum offset that may be caused by these instructions
Returns:
additional offset caused by possible change of this instruction's length

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 199 of file src/de/fub/bytecode/generic/InstructionHandle.java.

int InstructionHandle::updatePosition int   offset,
int   max_offset
[inline, protected]
 

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) instructions
max_offset   the maximum offset that may be caused by these instructions
Returns:
additional offset caused by possible change of this instruction's length

Reimplemented in BranchHandle, and BranchHandle.

Definition at line 143 of file lib/jpf/de/fub/bytecode/generic/InstructionHandle.java.

Referenced by InstructionList::setPositions().


Member Data Documentation

InstructionHandle InstructionHandle::ih_list = null [static, private]
 

Factory methods.

Definition at line 32 of file src/de/fub/bytecode/generic/InstructionHandle.java.


The documentation for this class was generated from the following files:
Generated at Thu Feb 7 07:16:45 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001