Package net.hydromatic.morel.compile
Enum Analyzer.Use
- All Implemented Interfaces:
Serializable,Comparable<Analyzer.Use>,java.lang.constant.Constable
- Enclosing class:
Analyzer
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 ConstantsEnum ConstantDescriptionThe 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic Analyzer.UseReturns 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 Details
-
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
Binding is not used. For a let (whether recursive or not), the binding can be discarded. -
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
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
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
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:
val g = fn ys => map (fn x => E) ysno code is duplicated, but a small bounded amount of work is duplicated, because the closure
fn x => Emust be allocated each timegis called. -
MULTI_UNSAFE
The binding may occur many times, including inside lambdas.
-
-
Constructor Details
-
Use
private Use()
-
-
Method Details
-
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
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
-