Repository navigation
Build: fix compiler-main-source comptime budget overflow on Windows (CRLF normalize) - #910
Merged
ehartford merged 1 commit intoSep 1, 2026
Conversation
…g budget comp_normalize_line_endings built its result with `out = out ++ slice` in a loop over the whole input. src/main.w is the amalgamated compiler source (~220KB), and on GitHub's Windows runners the checkout is CRLF (core.autocrlf=true by default), so the compiler-main-source action took the CR-rewrite path and recopied the growing buffer on every line. That is O(n^2) in bytes copied and now exceeds the 1 GiB comptime string-construction budget (1073873897 > 1073741824), failing the build before stage1 on both windows x86_64 and windows aarch64. Build the result with a StringBuilder, matching the sibling normalizers that already do this for the same reason (br_normalize_embedded_source in build/runtime.w, and the pcre2/package/sdk source generators). The Linux/mac LF path is unchanged: no CR means an early return, exactly as before.
ehartford
approved these changes
Sep 1, 2026
ehartford
pushed a commit
that referenced
this pull request
Sep 1, 2026
Measured peak is ~0.5 GB; any target crossing 1 GB is a memory regression and fails the build loudly, naming the target and its peak. Raising the limit is a deliberate visible edit at the tripwire — never a silent creep. Coverage note: pooled children carry exact wait4 rusage; in-process actions are independently capped at the same 1 GB by the comptime evaluator's string budget (#910), so the two guards agree on the number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
with buildfails before stage1 on GitHub's Windows runners (bothwindows x86_64andwindows aarch64), and now also redsmainitself:Every downstream error (
missing out/stage/bin/with-stage2.exefor the bridge,cimport-stubs, runtime, regex-IR objects, etc.) is a cascade from stage1 never
being produced.
Root cause
comp_normalize_line_endings(build/compiler.w) built its result without = out ++ slicein a loop over the whole input.src/main.wis theamalgamated compiler source (~220 KB), and GitHub's Windows runners check out
with CRLF (
core.autocrlf=trueby default). That trips the CR-rewrite path,which recopies the growing buffer on every line — O(n²) in bytes copied. As
the compiler source grew it crossed the 1 GiB comptime string-construction
budget (over by ~129 KB), so the
compiler-main-sourceaction now fails.Linux/macOS check out with LF, so
has_cris false and the function returnsearly — which is why only the Windows lanes fail.
Fix
Build the result with a
StringBuilder, matching the sibling normalizers thatalready do this for exactly this reason (
br_normalize_embedded_sourceinbuild/runtime.w, plus the pcre2 / package / sdk source generators). The LFpath is byte-for-byte unchanged (early return before the loop).
Verification
with build :compiler-main-sourceruns green;out/gen/main.wisbyte-identical to
src/main.won the LF path (unchanged behavior).br_normalize_embedded_source,which normalizes embedded sources on every build.
build/*.wis interpreted by the seed at build time, so this takes effect withno reseed; the seed already supports these
StringBuildercalls (the twin inbuild/runtime.wuses them on every build).