Skip to content

A copied list of source texts shares their bytes, and the debug allocator's ledger no longer degrades on regular addresses (part of #685) - #3584

Merged
ehartford merged 4 commits into
mainfrom
phase-arenas
Nov 24, 2026
Merged

ehartford merged 4 commits into
mainfrom
phase-arenas

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Three changes that came out of measuring #685.

1. The compiler stops copying every source text twice. sema_clone_str_list pushed a fresh copy of each str; it now returns the list as the value it is (D120: the table is shared until one side writes; D111: each str is a counted holder of its bytes). The pinned seed gives the spelling the same meaning (checked with a probe under its debug allocator: the copy outlives its source, a write to the copy leaves the original alone, leak count 0).

compiling the compiler before after
compiling stage, peak RSS 1,417 MB 1,352 MB
link-compiler (the 2,048 MB tripwire) 1,477 MB 1,384 MB
check of src/main.with, peak live 584 MB 559 MB

2. The debug allocator's ledger mixes an address before it picks a slot. It probed linearly from addr >> 4. Block addresses are regular, so with the allocation pattern change 1 produces, entries fell into the same runs of slots and a check of the compiler under WITH_DEBUG_ALLOC=1 did not finish in 22 minutes (all samples in dbg_record_alloc and dbg_ledger_entry). With the address mixed the same run takes 84 s.

3. WITH_DEBUG_ALLOC_SITES_SHOWN=<n> prints the n largest allocation sites instead of 24, which is what the by-stage table on #685 was added up from. Documented in deep-debugging-tools.md.

Evidence at the branch head: :behavior-tests, :debug-alloc-tests, :unit-return-review, :ceremony-census, :self-audit green; battery green; linux-aarch64 container leg green (:build, :behavior-tests, :debug-alloc-tests); :release-checks survey: all targets green.

Does not close #685: its remaining part (releasing the AST before code generation) needs the code generator to stop reading the AST, as measured on the issue.

Eric Hartford added 4 commits November 23, 2026 22:53
…_DEBUG_ALLOC_SITES_SHOWN), for adding them up by owner (#685)
… regular block addresses fell into the same runs and a probe walked thousands of entries (#685)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime: return empty small-object slabs to the OS; phase-scoped arenas (study delta 7)

1 participant