Class CodeGenerationAggregates

java.lang.Object
org.ek9lang.compiler.CompilerPhase
org.ek9lang.compiler.phase10.CodeGenerationAggregates
All Implemented Interfaces:
BiFunction<Workspace, CompilerFlags, CompilationPhaseResult>

public class CodeGenerationAggregates extends CompilerPhase
Generate all type of aggregates, typically classes, components, records, etc. See compilationContext.commandLine().targetArchitecture to determine what to prepare to create.

SINGLE THREADED per program. The whole phase runs inside the compilableProgramAccess.accept lock; code generation of a construct can trigger LAZY symbol resolution (e.g. getAllEffectiveMethods -> type coercion -> ModuleScope.resolveInThisModuleOnly), which re-enters that same lock. A parallel stream would run that re-entry on a DIFFERENT thread and deadlock re-acquiring the (non-cross-thread-reentrant) lock - so output is generated sequentially on the lock-holding thread where the ReentrantLock IS reentrant. The lock already serialises all program access, so a second parallel layer here gains nothing.