Skip to content

The src/ extern sweep: compiler modules reach the runtime and libc through imports; the machine's information is a record - #2621

Merged
ehartford merged 1 commit into
mainfrom
src-extern-sweep
Oct 25, 2026
Merged

ehartford merged 1 commit into
mainfrom
src-extern-sweep

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

The src/ extern sweep Eric asked for after the with_sysinfo(&info as *mut u8) question (D30 step 4's follow-up).

  • The last 31 duplicate runtime/libc declarations in src/ are gone: str_from_byte, i64_to_string (already imported through rt.rt_core), abort/exit/strerror/strtod (use std.libc.*), rt_read/rt_write/rt_close/rt_seek/rt_getcwd (use rt.platform). The wl_*/clang_* bridge entries and the tool mains stay extern: they are C symbols of our own bridge objects.
  • What the duplicates hid: exit declared as returning left dead code after it; three unsafe blocks wrapped libc calls that are safe by declaration; strtod was spelled over *const u8 where libc says *const c_char.
  • rt_core declares SysInfo once and with_system_info() -> SysInfo; std.sys reads the record. The byte form with_sysinfo(out) and the record copies in BuildGraphRuntime and CodegenUnits are seed-bound (src/ is compiled by the pinned seed against the seed's runtime interface) and go at the next seed cut, which is written down at both call sites, in rt_core, and in CLAUDE.md's D30 paragraph, which now states the rule for src/.

Battery: seed-driven, posted below when green.

…es the runtime and libc through imports, never an agreeing duplicate extern; the machine's information is a record

The last 31 duplicate declarations in src/ (str_from_byte and i64_to_string beside the rt.rt_core import that already had them; abort, exit, strerror, strtod now `use std.libc.*`; rt_read/rt_write/rt_close/rt_seek/rt_getcwd now `use rt.platform`, in ComptimeEval, FrameworkStubs, Runtime, LlvmBridge and ClangBridge) are gone. What the duplicates hid: `exit` declared as returning left a dead `return` after it (main.w); three `unsafe` blocks wrapped libc calls that are safe by declaration (R4c); ClangBridge spelled strtod over `*const u8` where libc says `*const c_char`. The `wl_*`/`clang_*` bridge entries and the tool mains stay extern: they are C symbols of our own bridge objects. rt_core declares `SysInfo { cpu_cores, memory_total, page_size }` once and `with_system_info() -> SysInfo`; std.sys reads the record. The byte form `with_sysinfo(out)` and the record copies in BuildGraphRuntime and CodegenUnits are seed-bound: src/ is compiled by the pinned seed against the seed's runtime interface, so they go once a seed carrying with_system_info is pinned (said in rt_core, at both call sites and in CLAUDE.md's D30 paragraph, which now states the rule for src/).
@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery GREEN on b99c8d3 (wall 360 s; gate, uat and battery-checks).

@ehartford
ehartford merged commit c88f3ee into main Oct 25, 2026
@ehartford
ehartford deleted the src-extern-sweep branch October 25, 2026 02:55
ehartford added a commit that referenced this pull request Oct 25, 2026
… stand-ins (sysinfo byte form, CiContracts sort, #2225 trim copy) (#2622)

* Pin the joint seed nightly-20261025-local-1-c88f3eeff0bc on the four gating platforms

Cut from main c88f3ee on the laptop (darwin), eric-5090 (linux-x86_64), win10 (windows-x86_64, published from the laptop) and tools/docker/linux-aarch64, each to a stage2 == stage3 fixpoint with :release-checks green. The first seeds whose runtime interface has with_system_info() -> SysInfo (#2621) and whose codegen gives a closure internal linkage in its codegen unit (#2618). windows-aarch64 stays on local-3 (D137).

* Retire the seed-bound sysinfo byte form: BuildGraphRuntime and CodegenUnits read with_system_info() -> SysInfo

The pinned seed now carries the record form (#2621), so the byte-form with_sysinfo(out) in rt_core and the two SysInfo copies in the compiler are deleted; CLAUDE.md D30 paragraph names the stand-in as the pattern a pin stack retires.

* CiContracts: the contracts artifact sorts its names with List.sort()

The insertion sort stood in while the pinned seed lacked the #2618 fix (a closure symbol external to its codegen unit was stripped at the stage1 link); the 2026-10-25 seed carries it. A name is a str, a value (D111): it is pushed, not cloned.

* rt_core: delete the owned str trim copy the STR_TRIM intrinsic once called (#2225)

str.trim() has been a std view method since 46876b6 (2026-10-07); no seed since lowers an intrinsic to with_str_trim_ref, and nothing in the tree names it. It was marked to retire at the next seed bump.

---------

Co-authored-by: Eric Hartford <[email protected]>
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.

1 participant