mirror of
https://github.com/apple/swift.git
synced 2026-10-20 19:13:47 +02:00
Embedded stdlib cross-compilation runs one swiftc per (module x triple), and each of those holds ~2 GB resident during IRGen. With ~28 embedded triples plus per-triple shim/overlay libraries, an unrestricted -j36 build lets ninja schedule dozens of these concurrently. On Linux CI that burst lines up with the finish of libsourcekitdInProc.so's LTO link and OOMs the runner -- three separate Linux PR jobs died at exactly the same ninja step (1644/2955). Route every embedded-SDK Swift compile through a dedicated CMake job pool sized at ceil(cores / 4) by default. Non-embedded compilations (host stdlib, SDK overlays) still run in the default pool at full parallelism. SWIFT_PARALLEL_EMBEDDED_COMPILE_JOBS overrides the depth when needed. Also thread a JOB_POOL argument through the shared add_custom_command_target helper so _compile_swift_files can attach the pool to each swiftc invocation it emits.