examples: lisp — drive wwstage by default; retire stale workarounds

Makefile sets WW_W6C=$(BIN)/w6c_ww so `make`, `make test`, and
`make demo` all use the ww-built backend. With the wwstage cgen
fixes in selfhost/cmd/wcc/ the demo no longer needs to dodge:

- bug #1+#2 (global addressing): symbol interner indexes
  sym_off / sym_len / sym_blob directly. No `let blob = sym_blob;`
  aliasing.
- bug #3 (chained non-pointer sub-struct field): not retired here
  (lexer.cur is still flattened) but the cgen now handles the
  shape; un-flattening is cosmetic.
- bug #4 (f64 through every boundary): vfloat writes p.fval = v
  directly; promote_v's FLOAT branch is one assign; to_f64 reads
  v.ival as f64 / v.fval directly. Drops fbuf, FVAL_OFF, copybytes.
- bug #7 (xs[i].field): builtins write xs[0].kind / xs[0].car
  directly; no `let p = xs[0];` first.

lisp_test still 101/101.

CLAUDE.md marks each historical bug as retired or still load-
bearing; #6 (slice-len in tagged-union return) and #8 (f64
compound assign) are the remaining shapes to avoid.
This commit is contained in:
2026-05-13 03:07:01 +09:00
parent 7c75dd218a
commit d9aba892f6
3 changed files with 96 additions and 175 deletions

View File

@@ -15,11 +15,18 @@
# (otherwise `-I.` collapses to ".", and the cgen mangles symbols as
# `..helper`, which then breaks the assembler).
WW := $(shell cd ../..; pwd)/out/bin/ww
HERE := $(shell pwd)
# Drive the wwstage cgen (w6c_ww) by default. The C-stage cgen has
# unfixed silent-miscompilation traps that lispcore used to dodge by
# hand; with the wwstage fixes in place we can write the natural
# shape (no flattened sub-structs, no aliased global indexers, no
# `let p = xs[i];` per builtin) and lisp_test still passes.
WW := $(shell cd ../..; pwd)/out/bin/ww
W6CWW := $(shell cd ../..; pwd)/out/bin/w6c_ww
HERE := $(shell pwd)
WWENV := WW_W6C=$(W6CWW)
lisp: lisp.ww lispcore.ww
$(WW) build lisp.ww -I $(HERE)
$(WWENV) $(WW) build lisp.ww -I $(HERE)
# `ww test <file.ww>` in single-file mode discards extra args, so we
# can't pass `-I` through it. Build the test as a normal binary and
@@ -28,7 +35,7 @@ test: lisp_test lisp
./lisp_test
lisp_test: lisp_test.ww lispcore.ww
$(WW) build lisp_test.ww -I $(HERE)
$(WWENV) $(WW) build lisp_test.ww -I $(HERE)
# Demo programs in tree. `make demo` runs every test_*.lisp through
# the REPL; each prints its results to stdout (errors go to stderr