Repository navigation
D119 step 3 (#2301): a C local or file-scope array becomes a List; three compiler fixes it surfaced - #2364
Merged
Conversation
added 15 commits
October 12, 2026 13:47
…ointer stays in the frame; a static constant was written through the pointer (a bus error in memset, or a read folded to the literal)
…its length (with-migrate-spec.md Arrays): locals, hoisted locals and globals declare List[T] (List[[T; N]] for rows), an uninitialized array is its zero fill, struct and union fields stay [T; N]; tools/corpus_bench.w times each corpus against its C before and after
…IR read it from the operands and lost a str read through a view of a view (`&&str ++ "x"`, a tuple-pattern binding over a `&str`), typing it Unit; a concat part is read through every view
…t, with its hold, before the block's scope-exit drops; `out.trim()` returned as a str read the freed buffer once `out` had grown
…elements beside the binding, a constant header with capacity 0); a pointer into it in another global's initializer folds to the elements; List.new() globals write 0 in word 3 (start, D115 Amendment 1 step 2)
…nd the static layout; corpus_bench without str clones
…; a `&str` tail of a `&str` function stays the borrow (ToolFs.scratch_dir)
…ter in the new global-List and tail code (and the two beside them)
…s (a corpus module has no prelude); a record element's fill is T.zeroed() (D101) when every field is zero-valid, else the array stays [T; N]
… later-numbered block (a List literal before a labeled block) was read before its definition and the store refused ("cannot lower projected assignment"); pcre2_substitute's hoisted List fills hit it
…ce builds and runs happen in work directories
…ises error paths and exits 1 for every build)
…thin 2%) recorded with the decision; corpus_bench builds tommyds from its amalgamation and reads c-algorithms' fresh tests from their own output
…als and tables as Lists; each corpus's upstream suite green fresh; benchmark within 2% of the previous promotion)
…3 migrator (each promote target green; one per src/main build invocation)
added 4 commits
October 12, 2026 14:15
…pe array is a stable List binding Codegen marked every stable (let) module global an LLVM constant, but §9.1c lets a stable binding's value mutate in place (field assignment, index writes, mut self methods): an element or field write to a stable List/struct global was silently lost (the read folded to the initializer) and a push wrote its header into a read-only page. Stable storage is now writable static data (finalize/declare and the List elements global), and a stable droppable global defined in the module registers its exit drop, as the runtime-init path already did. The migrator emitted a non-const C file-scope array as var List[T]: droppable mutable storage a .wo bundle cannot export (D39 Level 0), which is what tommyds' HASH32..INTHASH64 tables hit in the gate. C cannot assign an array, so an array that declares a List (D119) is a stable binding whether or not C spells it const; scalars and records keep the const-derived keyword. behav_stable_global_interior_write fails before (lost write, then bus error on push) and passes after.
…e arrays are stable List bindings; tommyds restored to main's corpus first so the release build could produce the fixed migrator)
…r rule (the battery gate's one red)
collect_struct_types_from_tid returned early for List/HashMap/HashSet without descending into their element/key/value types, while emitted code names the element type in casts and sizeof. A struct no local, parameter, or field carries directly was undeclared in the emitted C (30 of 32 emit-c-smoke cases failed to compile). Fixed arrays already descended; containers now do too. D119's migrator rule made this the common shape (pcre2's recurse_cache, reached only through a [recurse_cache.zeroed(); 8] hoisted local). Fixture: test/emit_c/list_element_struct_decl.w (used the type in a cast with no declaration before; declared after).
…emony census: move-arg in src rose 847 -> 848; the consuming signature takes the accumulator without the spelling)
Contributor
Author
|
Battery GREEN on 23db29c (seed-driven, Since the last update this stack also gained, each found by a battery round and fixed at the root with a failing-before fixture:
Follow-up filed: #2369 (bundle refusal should name the exact |
ehartford
marked this pull request as ready for review
October 12, 2026 23:49
ehartford
added a commit
that referenced
this pull request
Oct 13, 2026
…y, multi-target build driver, census --diff, stack_status, with-battery skill (#2375) * Agent scaffolding from the d119-step3 battery rounds: with-battery skill, census --diff, two iterate-tier rules - .agents/skills/with-battery: the operational checklist for stack work (worktree discipline, persistent battery monitor, phase timings, red triage, promote cycle, reseed), distilled from AGENTS.md and PR #2364's five battery rounds. Validated (muse skills validate). - tools/ceremony_census.w --diff REV: lexical ceremony counts of the files changed vs REV, worktree against REV, so a new ceremony is caught at the iterate tier instead of 13 minutes into a battery gate (run 5: one redundant move, 847 -> 848). Verified both ways: clean diff passes, an injected move fails. - AGENTS.md/CLAUDE.md (identical copies): absolute paths in staging worktrees (relative tool paths resolve to the main checkout), and after a migrator spelling change sweep every expectation of the old spelling plus run :c-migrator-basic-tests before the battery (a head-truncated grep hid flat_pairs and cost run 3). * battery: --survey runs every phase past a red one; the battery holds itself awake The phase barrier (a red gate stops the battery) made independent failures serialize across batteries ~35 minutes apart: on d119-step3 the Emit-C collector bug sat in battery-checks invisible behind two gate failures. --survey keeps phase order and the final verdict rules (RED if any phase was red) but runs UAT (when the gate left a release compiler; otherwise the skip is recorded) and battery-checks (whose own survey skips dependents of failed build targets) after a red phase, so one battery reports independent reds across phases. The battery also caffeinates itself for its whole run (caffeinate -i -s -w <own pid> on macOS): callers no longer wrap the invocation or hold a keep-awake lease, and a forgotten wrapper can no longer leave the driver asleep between phases. The per-phase child holds remain. * build driver: every :target selector names a root, not only the first driver_build_target_arg returned the first :target and the rest were silently discarded, so `build :zlib-promote :pcre2-promote :c-algorithms-promote :tommyds-promote` promoted zlib, said nothing, and exited 0 — carried as a one-promote-per-invocation ritual in the handoff instead of a driver bug. Now every selector is a root: DriverOptions collects selected_targets in order (duplicates dropped, selected_target remains the first for pseudo-target dispatch and labels), BuildGraphModel selects the union closure (build_graph_filter_targets; build_graph_filter_single_targets for --no-deps), and an undeclared name is a loud error. The install-user fast path and the effects pseudo-target still require a lone selector. Verified: --dry-run selects both roots, and one invocation ran both :lexer-tests (7 files) and :parser-tests (9 files) to green. * tools/stack_status.w: the generated half of a handoff Prints what git, gh, and the battery already know about the current stack — branch and HEAD, commits ahead of origin/main, tracked dirtiness, the branch's PR, the battery status file, the newest run log's verdict line — fresh at read time instead of copied by hand into a handoff that goes stale within hours (the d119-step3 handoff described a promote chain and a main that had already moved). Judgment (what to do next, which reds are pre-existing) stays the human-written part of a handoff; this replaces only its facts. * battery: drop the self-caffeinate spawn; per-phase holds already cover wakefulness The --survey commit added a spawn_os caffeinate -w self-hold on top of the per-phase holds the battery already had. ceremony_census --diff flagged its let _ = spawn as new ceremony, and on inspection the hold was redundant: every phase runs under caffeinate and the driver between phases only merges times and writes status for seconds. What remains is the documented rule in both places: no caller-side caffeinate wrapper or keep-awake lease — the ritual, not a missing hold, was the defect. * build driver: drop the redundant & at the multi-target call sites (ceremony-census ref-at-ref-param 1852 -> 1856 in the survey battery's gate; the parameters are references, so the places auto-ref) --------- Co-authored-by: Eric Hartford <[email protected]>
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.
Nine commits on
a31a7df52(rebase onto main before the battery).List[T],List[[T; N]]for rows, zero fills for uninitialized arrays, struct and union fields stay[T; N]); the d119_arrays, cross-file and global_init_list selfhost tests updated;tools/corpus_bench.w(C vs With before vs after, per corpus); the migrate spec's Arrays paragraph records the switch.varbuffer handed to memset was static data: bus error). Fixture behav_d119_literal_pointer_write.++;&&str ++ "x"(a tuple-pattern binding over a&str) typed Unit in MIR. Fixture behav_concat_view_of_view.out.trim()returned as a str read the freed buffer (pre-existing on main). Fixture behav_d111_view_tail_of_dropped_local.Gate 4 green. Next:
:corpus-migrator-gate,tools/corpus_bench.w, the four promotes, battery.