Enum Class CompilationPhase

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

public enum CompilationPhase extends Enum<CompilationPhase>
Identifies the ordered set of compilation phases used in EK9. This enables compilation to run up to specific phases. So for example in a language-server - you may never want to get to the 'generate' phase. Or during development - we may wish to focus on work up to a specific phase.
  • Enum Constant Details

  • Field Details

    • MODEL_FREEZE_AFTER

      public static final CompilationPhase MODEL_FREEZE_AFTER
      The phase after which the symbol model is complete and must not be mutated.

      It sits AFTER PRE_IR_CHECKS, not before it. Phase 5 legitimately records its analysis onto symbols - 41,873 putSquirrelledData writes from the quality checkers on the test corpus - and it is a CHECKING phase whose job includes recording what it found. Putting it on the frozen side would cost that and buy nothing measurable: that phase is already effectively lock-free (held/wall 0.02). The phases that actually pay - IR generation and code generation - are still covered.

  • Method Details

    • values

      public static CompilationPhase[] 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 CompilationPhase 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
    • getDescription

      public String getDescription()
    • isModelFrozen

      public boolean isModelFrozen()
      Is the symbol model frozen by the time this phase runs?

      This is a STATIC property of where a phase sits in the pipeline, not runtime state - which is the point. A post-freeze phase reads a model nobody is writing to, so it needs no lock and no synchronisation, and every one of its threads can read concurrently. Deriving that from the enum rather than from a mutable flag means there is no window in which the answer is wrong, and nothing to set, clear or forget.

      Returns:
      true if the model is complete and read-only for the duration of this phase.