Class LocalLocation

java.lang.Object
org.checkerframework.afu.scenelib.el.LocalLocation

public final class LocalLocation extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    final 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

    Constructors
    Constructor
    Description
    LocalLocation(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 Type
    Method
    Description
    boolean
     
    boolean
    Returns true if this LocalLocation equals o; a slightly faster variant of equals(Object) for when the argument is statically known to be another nonnull LocalLocation.
    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
     
    boolean
    Test if the bytecode offset to the start of the first scope/lifetime is defined.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • start

      public final org.objectweb.asm.Label[] start
      The starts of the lifetimes for the variable. Used only for TypeReference#LOCAL_VARIABLE and TypeReference#RESOURCE_VARIABLE.
    • end

      public final org.objectweb.asm.Label[] end
      The ends of the lifetimes for the variable. Used only for TypeReference#LOCAL_VARIABLE and TypeReference#RESOURCE_VARIABLE.
    • index

      public final int[] index
      The 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

      public final @Nullable String 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

      public LocalLocation(int index, String variableName)
      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 frame
      variableName - 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 lifetimes
      end - the code offsets to the ends of the variable's lifetimes
      index - the stack frame offsets of the variable's lifetimes
      variableName - 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 lifetime
      scopeLength - the bytecode length of the variable's lifetime
      index - 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

      public boolean equals(LocalLocation o)
      Returns true if this LocalLocation equals o; a slightly faster variant of equals(Object) for when the argument is statically known to be another nonnull LocalLocation.
      Parameters:
      o - the LocalLocation to compare to this
      Returns:
      true if this equals o
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object