ww: driver shells to wwstage tools

build_one now invokes 6c_ww / 6a_ww / 6l_ww from $self_dir, not
the C-built binaries that share the directory. After this change
`ww_ww build foo.ww` touches no cstage code at runtime — the
fresh-checkout cstage is still needed to bring the wwstage into
existence, but day-to-day work runs on the ww toolchain end to
end. The C `ww` driver in cmd/ww/ still drives the C 6c/6a/6l.

Test 993 (which used to be trivial — both drivers invoked the
same C tools) now meaningfully compares the cstage pipeline
against the wwstage pipeline on hello + wwdump and confirms
byte-identical exes.

The .combined.ww files for 6a/6l/ww/wwdump and smoke are
regenerated by the ww driver's `expand()` step; their diff is
the lib/os dup2 wrapper and the cgen.ww port from the prior two
commits, propagating into the bootstrap inputs.
This commit is contained in:
2026-05-11 11:20:23 +09:00
parent 218d8469ff
commit 502b304841
7 changed files with 272 additions and 43 deletions

20
PLAN.md
View File

@@ -293,16 +293,26 @@ Exit criteria:
### Status (2026-05)
Steps 16 done. The four ww-side tools live in `selfhost/cmd/`:
Steps 16 done. The five ww-side tools live in `selfhost/cmd/`:
- `wwc/` — ww-native lex/parse/check/cgen
- `wwc/` — ww-native lex/parse/check/cgen (the frontend library)
- `6c/` — ww-native compiler binary; thin driver over wwc's cgen
- `6a/` — ww-native amd64 assembler
- `6l/` — ww-native amd64 linker
- `ww/` — ww-native driver
- `ww/` — ww-native driver, shells to `6c_ww/6a_ww/6l_ww`
Step 7 reaches its fixed point: `make bootstrap` produces ww1 → ww2 →
ww3 with `cmp ww2 ww3` byte-identical. Tests 990993 confirm each
selfhost tool is byte-identical to its Cstage counterpart.
ww3 with `cmp ww2 ww3` byte-identical. Tests 990994 confirm each
selfhost tool is byte-identical to its Cstage counterpart on the
wwdump-corpus (and `ww_ww build` is byte-identical to `ww build` on
test 993's hello + wwdump corpus, despite using a different
toolchain underneath).
`ww_ww build foo.ww` is now C-free at runtime: the driver invokes
the wwstage tools end-to-end. Cstage is still required at first-
checkout time (no checked-in stage-0 binary yet) and for examples
that exercise the C-only features still missing from the ww side:
ET_DYN dynamic linking in 6l (commit `ecf0a84`, used by `snake`).
Exit criterion 1 (bootstrap green) is met. Exit criterion 2 (delete
the C trees) is **deferred to v1.0**: removing `cmd/wwc/`, `cmd/6c/`,