gnu.bytecode

Class Variable

public class Variable extends Location implements Enumeration

Constructor Summary
Variable()
Variable(String name)
Variable(String name, Type type)
Method Summary
voidallocateLocal(CodeAttr code)
Allocate slots for a local variable (or parameter).
booleandead()
voidfreeLocal(CodeAttr code)
booleanhasMoreElements()
booleanisAssigned()
Returns true iff assigned to a local variable slot.
booleanisParameter()
booleanisSimple()
Returns true for a "simple" variable.
ObjectnextElement()
VariablenextVar()
booleanreserveLocal(int varIndex, CodeAttr code)
Assign a local variable to a given local variable slot.
voidsetParameter(boolean parameter)
voidsetSimple(boolean simple)
StringtoString()

Constructor Detail

Variable

public Variable()

Variable

public Variable(String name)

Variable

public Variable(String name, Type type)

Method Detail

allocateLocal

public void allocateLocal(CodeAttr code)
Allocate slots for a local variable (or parameter).

dead

public final boolean dead()

freeLocal

public void freeLocal(CodeAttr code)

hasMoreElements

public final boolean hasMoreElements()

isAssigned

public final boolean isAssigned()
Returns true iff assigned to a local variable slot. Only relevant if isSimple ().

isParameter

public final boolean isParameter()

isSimple

public final boolean isSimple()
Returns true for a "simple" variable. A "simple" Variable can be stack-allocated using standard local variable slots. It is allocated by the codegen package. A non-simple variable may need heap allocation, or more more complex access; it is basically ignored by the codegen package, and must be managed by higher layers.

nextElement

public Object nextElement()

nextVar

public final Variable nextVar()

reserveLocal

public boolean reserveLocal(int varIndex, CodeAttr code)
Assign a local variable to a given local variable slot.

Parameters: varIndex the index of the local variables.

Returns: true iff we succeeded (i.e. the slot was unused)

setParameter

public final void setParameter(boolean parameter)

setSimple

public final void setSimple(boolean simple)

toString

public String toString()