Class LocalLocation
java.lang.Object
org.checkerframework.afu.scenelib.el.LocalLocation
A
LocalLocation
holds information about a local variable. A variable may have multiple
lifetimes. We store this information the same way ASM does, as 3 parallel arrays.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal org.objectweb.asm.Label[]
The ends of the lifetimes for the variable.final int[]
The indices for the variable.final org.objectweb.asm.Label[]
The starts of the lifetimes for the variable.The name of the variable. -
Constructor Summary
ConstructorsConstructorDescriptionLocalLocation
(int scopeStart, int scopeLength, int index) Construct a new LocalLocation representing a single scope/lifetime.LocalLocation
(int index, String variableName) Construct a new LocalLocation.LocalLocation
(org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, String variableName) Construct a new LocalLocation. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Returns true if thisLocalLocation
equalso
; a slightly faster variant ofequals(Object)
for when the argument is statically known to be another nonnullLocalLocation
.int
Returns the length of all the scopes/lifetimes (in bytes).int
Returns the bytecode offset to the start of the first scope/lifetime.int
Returns the local variable index of its first scope/lifetime.int
hashCode()
boolean
Test if the bytecode offset to the start of the first scope/lifetime is defined.toString()
-
Field Details
-
start
public final org.objectweb.asm.Label[] startThe starts of the lifetimes for the variable. Used only for TypeReference#LOCAL_VARIABLE and TypeReference#RESOURCE_VARIABLE. -
end
public final org.objectweb.asm.Label[] endThe ends of the lifetimes for the variable. Used only for TypeReference#LOCAL_VARIABLE and TypeReference#RESOURCE_VARIABLE. -
index
public final int[] indexThe indices for the variable. Each element of the index array contains the local variable's offset from the stack frame for the corresponding lifetime. Used only for TypeReference#LOCAL_VARIABLE and TypeReference#RESOURCE_VARIABLE. -
variableName
The name of the variable.This is not part of the abstract state of the LocalLocation: it is not read by equals(), hashCode(), or toString().
-
-
Constructor Details
-
LocalLocation
Construct a new LocalLocation. This constructor does not assign meaningful values to start or end. Thus, the getScopeStart and getScopeLenth methods must not be used on the result.- Parameters:
index
- the offset of the variable in the stack framevariableName
- the name of the local variable
-
LocalLocation
public LocalLocation(org.objectweb.asm.Label[] start, org.objectweb.asm.Label[] end, int[] index, String variableName) Construct a new LocalLocation.- Parameters:
start
- the code offsets to the starts of the variable's lifetimesend
- the code offsets to the ends of the variable's lifetimesindex
- the stack frame offsets of the variable's lifetimesvariableName
- the name of the local variable
-
LocalLocation
public LocalLocation(int scopeStart, int scopeLength, int index) Construct a new LocalLocation representing a single scope/lifetime. Only being used by Writers, not Readers for now. Should possibly deprecate this in the future. Changes values reflectively.- Parameters:
scopeStart
- the bytecode offset of the start of the variable's lifetimescopeLength
- the bytecode length of the variable's lifetimeindex
- the offset of the variable in the stack frame
-
-
Method Details
-
scopeStartDefined
public boolean scopeStartDefined()Test if the bytecode offset to the start of the first scope/lifetime is defined.- Returns:
- if the Label at start[0] is resolved
-
getScopeStart
public int getScopeStart()Returns the bytecode offset to the start of the first scope/lifetime.- Returns:
- the bytecode offset to the start of the first scope/lifetime
-
getScopeLength
public int getScopeLength()Returns the length of all the scopes/lifetimes (in bytes).- Returns:
- the length of all the scopes/lifetimes (in bytes)
-
getVarIndex
public int getVarIndex()Returns the local variable index of its first scope/lifetime.- Returns:
- the local variable index
-
equals
Returns true if thisLocalLocation
equalso
; a slightly faster variant ofequals(Object)
for when the argument is statically known to be another nonnullLocalLocation
.- Parameters:
o
- theLocalLocation
to compare to this- Returns:
- true if this equals
o
-
equals
-
hashCode
public int hashCode() -
toString
-