Class CompilerPhase
java.lang.Object
org.ek9lang.compiler.CompilerPhase
- All Implemented Interfaces:
BiFunction<Workspace, CompilerFlags, CompilationPhaseResult>, CompilationStep
- Direct Known Subclasses:
CodeGenerationAggregates, CodeGenerationApplications, CodeGenerationConstants, CodeGenerationPreparation, CodeOptimisation, IRAnalysis, IRGenerator, IROptimisation, ModuleDuplicateSymbolChecks, NonInferredTypeDefinition, Packaging, PackagingPostProcessing, PluginLinkage, PluginResolution, PostSymbolResolutionChecks, PreIntermediateRepresentationChecks, ReferenceChecks, SymbolDefinition, SymbolicAnalysis, SymbolResolution, TypeHierarchyChecks
Marks the specific activity of a compiler phase.
The phase and the compiler flags reach the compilable program through the driver (
Ek9Compiler), which
records each phase as entered before running it; components read them from the program during compilation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SharedThreadContext<CompilableProgram> protected final Consumer<CompilationEvent> protected final booleanIs the symbol model already complete and read-only by the time this phase runs?protected final CompilerReporter -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCompilerPhase(CompilationPhase phase, SharedThreadContext<CompilableProgram> compilableProgramAccess, Consumer<CompilationEvent> listener, CompilerReporter reporter) -
Method Summary
Modifier and TypeMethodDescriptionapply(Workspace workspace, CompilerFlags compilerFlags) protected abstract booleandoApply(Workspace workspace, CompilerFlags compilerFlags) Do the compilation phase.protected ParsedModulephase()The phase this step runs.protected voidtimedStage(String stage, Runnable work) Run one stage of this phase and, when verbose (-v), report it as one line:<PHASE>_STAGE.<stage> duration 12.345 ms cpu ... busyCores ... alloc ... gc ...- seeResourceSnapshot.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Field Details
-
listener
-
reporter
-
compilableProgramAccess
-
modelFrozen
protected final boolean modelFrozenIs the symbol model already complete and read-only by the time this phase runs?A plain
finalfield, fixed when the phase is constructed, because the answer is a static property of where the phase sits in the pipeline - seeCompilationPhase.isModelFrozen(). There is deliberately no setter and no flag to maintain: nothing can set it late, clear it early, or forget to. A post-freeze phase reads a model nobody writes to, so it needs neither the lock nor any other synchronisation, and all of its threads may read concurrently.
-
-
Constructor Details
-
Method Details
-
doApply
Do the compilation phase. -
phase
Description copied from interface:CompilationStepThe phase this step runs.- Specified by:
phasein interfaceCompilationStep
-
apply
- Specified by:
applyin interfaceBiFunction<Workspace, CompilerFlags, CompilationPhaseResult>
-
timedStage
Run one stage of this phase and, when verbose (-v), report it as one line:<PHASE>_STAGE.<stage> duration 12.345 ms cpu ... busyCores ... alloc ... gc ...- seeResourceSnapshot. PRE_IR_CHECKS reports asPRE_IR_STAGE, the name the scale tooling and its baselines already use. The stage name contains a '.' and lower-case letters, so a parser keyed on the all-caps phase-name line never mistakes a stage for a phase.Permanent and free when not verbose, so a timing run never needs a patched compiler (it replaced the reversible
tools/scale/patch_phase5_timing.py, retired 2026-10-01). Formatted withLocale.ROOTso a comma-decimal locale cannot break the parsers. -
getParsedModuleForSource
-