Enum Analyzer.Use

java.lang.Object
java.lang.Enum<Analyzer.Use>
net.hydromatic.morel.compile.Analyzer.Use
All Implemented Interfaces:
Serializable, Comparable<Analyzer.Use>, java.lang.constant.Constable
Enclosing class:
Analyzer

public static enum Analyzer.Use extends Enum<Analyzer.Use>
How a binding (assignment of a value to a variable) is used.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The binding is an atom (variable or literal).
    Binding is not used.
    Indicates that the binding cannot be inlined because recursively refers to itself (or more precisely, is part of a recursive cycle and has been chosen as the link to remove to break the cycle).
    The binding occurs at most once in each of several distinct case branches; none of these occurrences is inside a lambda.
    The binding may occur many times, including inside lambdas.
    The binding occurs exactly once, and that occurrence is not inside a lambda, nor is a constructor argument.
    The binding occurs exactly once, but inside a lambda.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Use()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    static Analyzer.Use[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

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

    • LOOP_BREAKER

      public static final Analyzer.Use LOOP_BREAKER
      Indicates that the binding cannot be inlined because recursively refers to itself (or more precisely, is part of a recursive cycle and has been chosen as the link to remove to break the cycle).
    • DEAD

      public static final Analyzer.Use DEAD
      Binding is not used. For a let (whether recursive or not), the binding can be discarded.
    • ONCE_SAFE

      public static final Analyzer.Use ONCE_SAFE
      The binding occurs exactly once, and that occurrence is not inside a lambda, nor is a constructor argument. Inlining is unconditionally safe; it duplicates neither code nor work.
    • ATOMIC

      public static final Analyzer.Use ATOMIC
      The binding is an atom (variable or literal). Regardless of how many times it is used, inlining is unconditionally safe; it duplicates neither code nor work.
    • MULTI_SAFE

      public static final Analyzer.Use MULTI_SAFE
      The binding occurs at most once in each of several distinct case branches; none of these occurrences is inside a lambda. For example:
      
       case xs of
         [] => y + 1
       | x :: xs => y + 2
       

      In this expression, y occurs only once in each case branch. Inlining y may duplicate code, but it will not duplicate work.

    • ONCE_UNSAFE

      public static final Analyzer.Use ONCE_UNSAFE
      The binding occurs exactly once, but inside a lambda. Inlining will not duplicate code, but it might duplicate work.

      We must not inline an arbitrary expression inside a lambda, as the following example (from GHC inlining section 2.2) shows:

      
       val f = fn x => E
       val g = fn ys => map f ys
       

      If we were to inline f inside g, thus:

      
       val g = fn ys => map (fn x => E) ys
       

      no code is duplicated, but a small bounded amount of work is duplicated, because the closure fn x => E must be allocated each time g is called.

    • MULTI_UNSAFE

      public static final Analyzer.Use MULTI_UNSAFE
      The binding may occur many times, including inside lambdas.
  • Constructor Details

    • Use

      private Use()
  • Method Details

    • values

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

      public static Analyzer.Use valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null