JML

org.multijava.util.classfile
Class InstructionHandle

java.lang.Object
  extended byorg.multijava.util.classfile.AbstractInstructionAccessor
      extended byorg.multijava.util.classfile.InstructionHandle
All Implemented Interfaces:
InstructionAccessor

class InstructionHandle
extends AbstractInstructionAccessor


Field Summary
private  int index
           
private  Instruction insn
           
private  InstructionHandle next
           
private  CodePosition position
           
private  int stackHeight
           
 
Constructor Summary
InstructionHandle(Instruction insn, InstructionHandle prev)
          Creates a new instruction handle.
 
Method Summary
 void attachTo(AccessorContainer container)
          Notifies this handle that is has been attached to the specified container.
(package private)  boolean checkInstruction(CodeEnv env, int curStack)
          Verifies the enclosed instruction and computes the stack height.
(package private)  void dump()
           
 Instruction getInstruction()
          Returns the enclosed instruction.
(package private)  int getLocalVar()
          Returns the maximum index of local vars used by this instruction.
 InstructionHandle getNext()
          Returns the handle of the next instruction in textual order.
(package private)  CodePosition getPosition()
          Gets the position of current instruction
(package private)  int getStackHeight()
          Returns the stack height after execution of this instruction.
(package private)  void setAddress()
          Sets the final position of this instruction in the code array.
(package private)  boolean setAddressAndAdvancePC(CodePosition position)
          Sets the position of this instruction and return true if address is final
 
Methods inherited from class org.multijava.util.classfile.AbstractInstructionAccessor
transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

insn

private final Instruction insn

next

private InstructionHandle next

index

private int index

position

private CodePosition position

stackHeight

private int stackHeight
Constructor Detail

InstructionHandle

public InstructionHandle(Instruction insn,
                         InstructionHandle prev)
Creates a new instruction handle.

Parameters:
insn - the instruction
prev - the handle of the next instruction in textual order
Method Detail

getInstruction

public Instruction getInstruction()
Returns the enclosed instruction.


getNext

public InstructionHandle getNext()
Returns the handle of the next instruction in textual order.


attachTo

public void attachTo(AccessorContainer container)
Notifies this handle that is has been attached to the specified container.


getPosition

CodePosition getPosition()
Gets the position of current instruction


getStackHeight

final int getStackHeight()
Returns the stack height after execution of this instruction.


getLocalVar

final int getLocalVar()
Returns the maximum index of local vars used by this instruction.


checkInstruction

final boolean checkInstruction(CodeEnv env,
                               int curStack)
                        throws ClassFileFormatException
Verifies the enclosed instruction and computes the stack height.

Parameters:
env - the check environment
curStack - the stack height at the beginning of the execution of the instruction
Returns:
true iff the next instruction in textual order needs to be checked, i.e. this instruction has not been checked before and it can complete normally
Throws:
ClassFileFormatException - a problem was detected

setAddressAndAdvancePC

boolean setAddressAndAdvancePC(CodePosition position)
Sets the position of this instruction and return true if address is final


setAddress

void setAddress()
Sets the final position of this instruction in the code array.


dump

void dump()

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.