Package gnu.bytecode
Class Variable
java.lang.Object
gnu.bytecode.Location
gnu.bytecode.Variable
- All Implemented Interfaces:
Enumeration
Information about a local variable in a method's code.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe local variable slot number used by this variable. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallocateLocal(CodeAttr code) Allocate slots for a local variable (or parameter).final booleandead()voidgetScope()final booleanfinal booleanReturns true iff assigned to a local variable slot.final booleanfinal booleanisSimple()Returns true for a "simple" variable.final VariablenextVar()booleanreserveLocal(int varIndex, CodeAttr code) Assign a local variable to a given local variable slot.final voidsetParameter(boolean parameter) final voidsetSimple(boolean simple) toString()Methods inherited from class gnu.bytecode.Location
getName, getSignature, getType, setName, setName, setSignature, setTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIterator
-
Field Details
-
offset
public int offsetThe local variable slot number used by this variable. Not used (by the codegen layer) if !isSimple().
-
-
Constructor Details
-
Variable
public Variable() -
Variable
-
Variable
-
-
Method Details
-
nextVar
-
hasMoreElements
public final boolean hasMoreElements()- Specified by:
hasMoreElementsin interfaceEnumeration
-
nextElement
- Specified by:
nextElementin interfaceEnumeration
-
isAssigned
public final boolean isAssigned()Returns true iff assigned to a local variable slot. Only relevant if isSimple (). -
getScope
-
dead
public final boolean dead() -
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. -
setSimple
public final void setSimple(boolean simple) -
isParameter
public final boolean isParameter() -
setParameter
public final void setParameter(boolean parameter) -
reserveLocal
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)
-
allocateLocal
Allocate slots for a local variable (or parameter). -
freeLocal
-
toString
-