net.sf.transjvm
Class Frame

java.lang.Object
  extended by net.sf.transjvm.Frame

public class Frame
extends java.lang.Object

Class representing a stack frame.

Author:
Mark Shannon

Constructor Summary
Frame(boolean _static, TypeID... parameterTypes)
          Constructs a Frame object
Frame(TypeID[] parameterTypes, boolean _static)
          Constructs a Frame object
 
Method Summary
 Variable _this()
          Returns a Variable for this.
 void free(Variable var)
          Frees a frame variable, allowing it to be reallocated.
 int maxLocals()
           
 Statement name(Variable var, java.lang.String name, Statement s)
          Assigns a name to a variable from this Frame, for debugging purposes.
 Variable parameter(int n)
          Returns a variable for parameter n.
 Variable variable(TypeID type)
          Allocates a new variable from this Frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Frame

public Frame(boolean _static,
             TypeID... parameterTypes)
Constructs a Frame object

Parameters:
_static - True if the method is static.
parameterTypes - The parameters for method of this stack frame.

Frame

public Frame(TypeID[] parameterTypes,
             boolean _static)
Constructs a Frame object

Parameters:
parameterTypes - The parameters for method of this stack frame.
_static - True if the method is static.
Method Detail

maxLocals

public int maxLocals()

_this

public final Variable _this()
Returns a Variable for this.

Returns:
A stack variable for this, null if a static method.

parameter

public final Variable parameter(int n)
Returns a variable for parameter n.

Parameters:
n - Index of the parameter
Returns:
A stack variable for parameter n.
Throws:
IndexOutofBoundsException - If n < 0 or n >= number of parameters.

free

public void free(Variable var)
Frees a frame variable, allowing it to be reallocated. Using a variable after it has been freed is an error.

Parameters:
var - Variable to be freed.
Throws:
java.lang.IllegalArgumentException - if var does not belong to this Frame.

variable

public Variable variable(TypeID type)
Allocates a new variable from this Frame.

Parameters:
type - The type of the new Variable.
Returns:
The newly allocated Variable.

name

public Statement name(Variable var,
                      java.lang.String name,
                      Statement s)
Assigns a name to a variable from this Frame, for debugging purposes. The name will be attached to the variable during the returned Statement.

Returns:
A Statement which is functionally equivalent to s and names var.


Copyright 2004-5, Mark Shannon