Enum Class ValueKind

java.lang.Object
java.lang.Enum<ValueKind>
org.ek9lang.compiler.ir.support.ValueKind
All Implemented Interfaces:
Serializable, Comparable<ValueKind>, Constable

public enum ValueKind extends Enum<ValueKind>
A value's ownership kind (EK9_IR_OWNERSHIP_MODEL.md ยง3), and THE rule for the kind of the value an instruction makes. The generator asks it before it states a value's owner (VariableMemoryManagement: a value made here is owned by the scope, anything else borrowed for it) and the verifier asks it before it checks that statement (OwnershipVerifier) - one rule, so the two can never disagree about what arrived owned.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    +0: valid while its source is - a load of a variable, field, static or constant, a function instance.
    No count at all: an unmanaged call result, a primitive or Void result, a constructor delegation's.
    +1: the activation that holds it consumes it exactly once on every path - a call result, a literal, a collection literal, a string interpolation, a static's value taken out of it, the exception an assert-throws or assert-panic expression caught.
  • Method Summary

    Modifier and Type
    Method
    Description
    static ValueKind
    madeBy(IRInstr instruction)
    The kind of the value instruction makes; null when it makes none, or states none (a STORE, and a CAST, which forwards its operand's kind - V-D).
    static boolean
    Does this call hand back an owned (+1) result - whether or not the IR names it? A call that does and names no result discards a count: the native back end releases nothing it was not told to.
    static ValueKind
    Returns the enum constant of this class with the specified name.
    static ValueKind[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • OWNED

      public static final ValueKind OWNED
      +1: the activation that holds it consumes it exactly once on every path - a call result, a literal, a collection literal, a string interpolation, a static's value taken out of it, the exception an assert-throws or assert-panic expression caught.
    • BORROWED

      public static final ValueKind BORROWED
      +0: valid while its source is - a load of a variable, field, static or constant, a function instance.
    • NONE

      public static final ValueKind NONE
      No count at all: an unmanaged call result, a primitive or Void result, a constructor delegation's.
  • Method Details

    • values

      public static ValueKind[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ValueKind valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • returnsOwned

      public static boolean returnsOwned(CallInstr call)
      Does this call hand back an owned (+1) result - whether or not the IR names it? A call that does and names no result discards a count: the native back end releases nothing it was not told to.
    • madeBy

      public static ValueKind madeBy(IRInstr instruction)
      The kind of the value instruction makes; null when it makes none, or states none (a STORE, and a CAST, which forwards its operand's kind - V-D).