Enum Analyzer.Use

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ATOMIC
      The binding is an atom (variable or literal).
      DEAD
      Binding is not used.
      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).
      MULTI_SAFE
      The binding occurs at most once in each of several distinct case branches; none of these occurrences is inside a lambda.
      MULTI_UNSAFE
      The binding may occur many times, including inside lambdas.
      ONCE_SAFE
      The binding occurs exactly once, and that occurrence is not inside a lambda, nor is a constructor argument.
      ONCE_UNSAFE
      The binding occurs exactly once, but inside a lambda.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Use()  
    • Enum Constant Detail

      • 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 Detail

      • Use

        private Use()
    • Method Detail

      • values

        public static Analyzer.Use[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Analyzer.Use c : Analyzer.Use.values())
            System.out.println(c);
        
        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