Skip to content

D30 step 4: the flip — the runtime bundle is the only path; WITH_RT_IN_UNIT and the .w-derived runtime objects are gone - #2500

Merged
ehartford merged 6 commits into
mainfrom
d30-step4
Oct 20, 2026
Merged

ehartford merged 6 commits into
mainfrom
d30-step4

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

D30 step 4: the flip — the runtime bundle is the only path; WITH_RT_IN_UNIT and the .w-derived runtime objects are gone

Plan §10 step 4 (docs/proposals/d30-implementation-plan.md). Six commits:

  1. The flip. Every unit with a prelude parses the runtime interface and every link whose undefined symbols reach the runtime joins the bundle; WITH_RT_IN_UNIT is read nowhere (lane fixtures run as every test; the verdict key dropped it; the lane sweep tool is gone).
  2. Link.w only. The three object-world branches and the per-compile lane flag are gone; the runtime is the bundle, fiber_asm.o with it off wasm, the cimport_stubs archive on demand.
  3. build.w. No stage, cross tag or wasm32 produces, embeds, installs or compares rt_core.o and the seven other .w-derived runtime objects; a runtime root's identity is its rt.o against the embedded rt slot (D132). The seed-built bootstrap objects stay until a post-flip seed.
  4. Sema. The §18.3 pass admits the compiler's sources to use rt.* (the src/ extern sweep, tools/sweep_rt_externs.w, waits for a seed carrying this); eight unsafe blocks in std and src that only called a safe runtime function are unwrapped.
  5. Docs. AGENTS.md/CLAUDE.md state the landed design; the plan, the ruling's status and wo_bundles.md record step 4.
  6. R4c deferred (its own stack: the migrator writes unsafe { with_alloc(...) } into every corpus; 40 in c_algorithms alone).

Gate: green (240 s). Battery: posted below.

Eric Hartford added 6 commits October 20, 2026 16:04
…RT_IN_UNIT is gone

The runtime-in-unit lane is the compiler's only path: the frontend parses
the runtime module set (the interface, with the bundle's object at the
link) into every unit that has a prelude, and the link joins the runtime
bundle whenever the unit is such a unit — exactly what WITH_RT_IN_UNIT=1
selected since R2b. The variable is read nowhere: not by the frontend, the
driver, the bundle build (whose compiles were the lane's already) or the
test-verdict key (the key's own test now flips WITH_CODEGEN_UNITS); the
lane sweep tool goes (a sweep is `with test`), and the thirteen lane
fixtures drop their `//! env:` header and run as every test does.

The object-world link paths stay in Link.w for this commit and go in the
next (bootstrap rule: Link.w changes alone). Verified: `:dev` green, the
fourteen former lane fixtures and the verdict-key test pass under stage1,
hello world links the bundle (21 runtime definitions after dead-strip).
… (D30 step 4, Link.w)

Three branches linked the .w-derived runtime objects — rt_core.o, the
platform object, panic_runtime.o, compat_runtime.o, fiber_stubs.o, plus
cimport_stubs.o for the compiler and for c_import programs — chosen by the
unit's undefined symbols; the lane's branch linked none of them. The lane's
branch is the rule: the runtime bundle joins whenever the unit's undefined
symbols reach the runtime (the `rt` slot, or this generation's bundle beside
the runtime root), fiber_asm.o with it off wasm, and a unit that reaches
libc or c_import symbols takes the on-demand cimport_stubs archive. The
lane flag Compilation set per compile is gone with the branches it chose
between, as is the compat-runtime predicate only they read.

Verified: `:dev`, the former lane fixtures, hello world and the c_import
fixture under stage1; the full build and `:fixpoint` (stage2 == stage3,
every runtime bundle pair) green.
… the runtime (D30 step 4)

rt_core.o, the platform object, panic_runtime.o, compat_runtime.o,
fiber_stubs.o, channel_runtime.o, fiber_runtime.o and fiber.o were compiled
for stage1, stage2, the four cross tags and wasm32, embedded as nineteen
blobs, installed, and compared byte for byte to judge a runtime root. No
link reaches them since the previous commit: every stage, cross and wasm32
producer, embedding, group, install and the per-name blob table in Link.w
go; cimport_stubs.o and fiber_asm.o stay, and the runtime root's identity
is its rt.o against the embedded `rt` slot (plus those two). The
seed-built bootstrap objects (bootstrap-*-object) stay until a post-flip
seed exists: the pinned seed links stage1 in the object world. The emit-C
smoke, two selfhost C links and the same-bytes test link out/lib/rt.o,
fiber_asm.o and cimport_stubs.o; the stale-out/lib fixture plants a stale
rt.o and rt.manifest; `:cross-rt-wasm` is the wasm32 bundle plus the wasm32
corpus bundles; the install set gains rt.{o,wi,manifest}.

Verified: `:dev`; the stale-runtime, c_import, compiler-module and hello
fixtures under stage1; the full build, `:fixpoint`, emit-c-smoke,
cli-selfhost-edge-tests and every-target-check green.
… sources may import the runtime

R4c: the D30 transition branch counted any with_*/rt_*/wl_* call inside
`unsafe` as an unsafe operation, so a block written for the extern world
stayed honest in both worlds. With the runtime a real definition in every
unit (step 4), the declaration decides: a safe runtime function makes such
a block vacuous, and the eight blocks that only called one are unwrapped
(std.string's append, std.libc's assert text, the tar, xz and bzip2 readers,
the framework stubs' read). `with check src/main.w` under stage1 is clean.

The §18.3 pass admits the compiler's own sources (src/) to `use rt.*`, as it
admits the standard library's: the 450 externs in src/ become imports with
`tools/sweep_rt_externs.w` (the step-3 sweep, keeping the ten LLVM/clang
bridge externs the interface does not provide) once a seed carrying this
rule is pinned — the pinned seed refuses the import from src/ and compiles
stage1.
… (AGENTS.md, the plan, the ruling, wo_bundles.md)

AGENTS.md/CLAUDE.md: the Runtime Architecture section states the landed
design instead of the transitional one; the `with_*` section drops its
deprecated-tier framing and states the rules that remain (user programs
never name a runtime symbol; std imports the runtime; a vacuous unsafe
around a runtime call is refused; src/ externs follow the next seed).
The plan's §10 records step 4, the D30 ruling's status line says landed,
wo_bundles.md gains "Step 4: the flip".
…unsafe

The gate's corpus bundle builds refused 40 vacuous `unsafe { with_alloc(...) }`
blocks in c_algorithms alone: the migrator writes them, and a corpus is never
edited by hand (D112). The transition branch returns, documented as R4c
pending (its own stack: the migrator stops wrapping runtime calls, the
corpora re-promote, the branch goes). The eight unwrapped blocks in std and
src stay unwrapped: the calls are safe either way.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on 332cd3a (288 s, this Mac, seed nightly-20261020-local-2): gate (240 s), uat, battery-checks. The runtime bundle is the only link path now; hello world links 21 runtime definitions after dead-strip, the stale-root fixture plants rt.o/rt.manifest and proves neither links, every-target-check green for all six targets, emit-C smoke green against out/lib/rt.o.

@ehartford
ehartford marked this pull request as ready for review October 20, 2026 23:55
@ehartford
ehartford merged commit f95b8f8 into main Oct 20, 2026
@ehartford
ehartford deleted the d30-step4 branch October 20, 2026 23:55
ehartford added a commit that referenced this pull request Oct 21, 2026
…oins and registers once (#2507)

Since #2500 every compiler embeds `rt@<tag>` for the cross tags beside its
native `rt` slot. On a Linux host both are this target's (the native
slot's "" and linux_x86_64 both resolve to it), so the stage3 link took the
same extracted wo_rt.o twice — 20 duplicate symbols at the Linux fixpoint,
the same at the linux-aarch64 compiler link; the Mac has no darwin tag and
never saw it. The runtime joins once (the first slot for the target) and
its interface registers once.

Co-authored-by: Eric Hartford <[email protected]>
@ehartford ehartford mentioned this pull request Oct 21, 2026
ehartford added a commit that referenced this pull request Oct 21, 2026
…#2508)

The first seeds built after the D30 step 4 flip (#2500) and R4c (#2504):
the runtime bundle is their only link path. darwin on the laptop, linux-
x86_64 on eric-5090, windows-x86_64 on win10, linux-aarch64 in the arm64
container (asset copied from out/release/bin/with, #2494), each from a
stage2 == stage3 fixpoint; windows-aarch64 is cross seed run 39537985417
(D137). Workflow pins rewritten by tools/bump_seed_pins.w.

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