Class LocalVariable

java.lang.Object
net.covers1624.coffeegrinder.bytecode.Instruction
net.covers1624.coffeegrinder.bytecode.insns.LocalVariable
All Implemented Interfaces:
net.covers1624.quack.util.Copyable<Instruction>
Direct Known Subclasses:
ParameterVariable

public class LocalVariable extends Instruction
Represents a variable within a Method.

Created by covers1624 on 23/2/21.

  • Constructor Details

  • Method Details

    • addReference

      public void addReference(LocalReference insn)
    • removeReference

      public void removeReference(LocalReference insn)
    • getDirectFlags

      public EnumBitSet<InstructionFlag> getDirectFlags()
      Description copied from class: Instruction
      Any direct flags for this Instruction.

      The return value should be cached statically inside the Instruction impl.

      Specified by:
      getDirectFlags in class Instruction
      Returns:
      An EnumBitSet representing the flags.
      See Also:
    • accept

      public <R, C> R accept(InsnVisitor<R,C> visitor, C ctx)
      Description copied from class: Instruction
      Pass this Instruction through the supplied InsnVisitor.
      Specified by:
      accept in class Instruction
      Parameters:
      visitor - The InsnVisitor.
      ctx - The context.
      Returns:
      The return result from the InsnVisitor.
    • getResultType

      public AType getResultType()
      Description copied from class: Instruction
      Gets the stack type of the value produced by this Instruction.
      Specified by:
      getResultType in class Instruction
      Returns:
      The AType.
    • getKind

      public LocalVariable.VariableKind getKind()
    • getGenericSignature

      @Nullable public @Nullable String getGenericSignature()
    • getType

      public AType getType()
    • getIndex

      public int getIndex()
    • getName

      public String getName()
    • getSubId

      public int getSubId()
    • getReferences

      public List<LocalReference> getReferences()
    • isSynthetic

      public boolean isSynthetic()
    • getAnnotationSupplier

      public AnnotationSupplier getAnnotationSupplier()
    • setGenericSignature

      public void setGenericSignature(@Nullable @Nullable String genericSignature)
    • setType

      public void setType(AType type)
    • setName

      public void setName(String name)
    • setSubId

      public void setSubId(int subId)
    • setSynthetic

      public void setSynthetic(boolean synthetic)
    • setAnnotationSupplier

      public void setAnnotationSupplier(AnnotationSupplier annotationSupplier)
    • getLoadCount

      public int getLoadCount()
      The number of instructions currently referencing this variable which read from it.
      Returns:
      The number of read references.
    • getStoreCount

      public int getStoreCount()
      The number of instructions currently referencing this variable which write to it.
      Returns:
      The number of write references.
    • getReferenceCount

      public int getReferenceCount()
      Gets the total number of references this variable has.
      Returns:
      The number of references.
    • isDead

      public boolean isDead()
      If this variable can be considered dead.

      A variable is considered dead if: 1, It is not a parameter. 2, The variable has no stores.

      Returns:
      If the variable is dead.
    • getUniqueName

      public String getUniqueName()