Package net.hydromatic.morel.compile
Enum Analyzer.Use
- java.lang.Object
-
- java.lang.Enum<Analyzer.Use>
-
- net.hydromatic.morel.compile.Analyzer.Use
-
- All Implemented Interfaces:
Serializable,Comparable<Analyzer.Use>
- Enclosing class:
- Analyzer
public static enum Analyzer.Use extends Enum<Analyzer.Use>
How a binding (assignment of a value to a variable) is used.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ATOMICThe binding is an atom (variable or literal).DEADBinding is not used.LOOP_BREAKERIndicates 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_SAFEThe binding occurs at most once in each of several distinct case branches; none of these occurrences is inside a lambda.MULTI_UNSAFEThe binding may occur many times, including inside lambdas.ONCE_SAFEThe binding occurs exactly once, and that occurrence is not inside a lambda, nor is a constructor argument.ONCE_UNSAFEThe binding occurs exactly once, but inside a lambda.
-
Constructor Summary
Constructors Modifier Constructor Description privateUse()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Analyzer.UsevalueOf(String name)Returns the enum constant of this type with the specified name.static Analyzer.Use[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
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 + 2In this expression,
yoccurs only once in each case branch. Inliningymay 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 ysIf we were to inline f inside g, thus:
no code is duplicated, but a small bounded amount of work is duplicated, because the closureval g = fn ys => map (fn x => E) ysfn x => Emust be allocated each timegis called.
-
MULTI_UNSAFE
public static final Analyzer.Use MULTI_UNSAFE
The binding may occur many times, including inside lambdas.
-
-
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 nameNullPointerException- if the argument is null
-
-