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 TypeFieldDescriptionint
The local variable slot number used by this variable. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
allocateLocal
(CodeAttr code) Allocate slots for a local variable (or parameter).final boolean
dead()
void
getScope()
final boolean
final boolean
Returns true iff assigned to a local variable slot.final boolean
final boolean
isSimple()
Returns true for a "simple" variable.final Variable
nextVar()
boolean
reserveLocal
(int varIndex, CodeAttr code) Assign a local variable to a given local variable slot.final void
setParameter
(boolean parameter) final void
setSimple
(boolean simple) toString()
Methods inherited from class gnu.bytecode.Location
getName, getSignature, getType, setName, setName, setSignature, setType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
hasMoreElements
in interfaceEnumeration
-
nextElement
- Specified by:
nextElement
in 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
-