|
@@ -1,39 +1,40 @@
|
|
|
-# m2compiler-V3 — status (2026-10-07)
|
|
|
|
|
|
|
+# m2compiler-V3 — status (2026-10-08)
|
|
|
|
|
|
|
|
This answers "where are we after all the refactoring?".
|
|
This answers "where are we after all the refactoring?".
|
|
|
|
|
|
|
|
-## MILESTONE (2026-10-07): the switch is flipped
|
|
|
|
|
|
|
+## MILESTONE (2026-10-08): L7 complete
|
|
|
|
|
|
|
|
-**Lower is now the only active emitter.** A plain `./M2` run emits
|
|
|
|
|
-the image through `Lower` from the AST; the grammar's inline emit is
|
|
|
|
|
-still present but runs suppressed (`SetNoEmit`) and is discarded, so
|
|
|
|
|
-it no longer reaches the buffer. Verified:
|
|
|
|
|
|
|
+**Lower is the only emitter**; the grammar's inline emit is gone from
|
|
|
|
|
+every production where it could be removed cleanly, `-lower` is retired,
|
|
|
|
|
+and the dead scaffolding is swept. Verified:
|
|
|
|
|
|
|
|
-- `run_tests.sh` is **204/204** (the `expect_run` tests now exercise
|
|
|
|
|
- Lower end to end through qbe/cc/execution).
|
|
|
|
|
-- `bootstrap/fixpoint.sh` is **FIXPOINT OK** (3,553,701 bytes).
|
|
|
|
|
|
|
+- `run_tests.sh` is **184/184**.
|
|
|
|
|
+- `bootstrap/fixpoint.sh` is **FIXPOINT OK** (3,392,601 bytes).
|
|
|
|
|
|
|
|
-The `-lower` flag is now test-only: it does not change *what* is
|
|
|
|
|
-emitted, only names the image `<mod>L.ssa` for the byte-compare
|
|
|
|
|
-harness. The byte-identity milestone (Lower == legacy inline on every
|
|
|
|
|
-single-file test and every session) is what made this a no-op flip.
|
|
|
|
|
|
|
+The L7 flip itself (2026-10-07) was a no-op because `Lower` had been
|
|
|
|
|
+verified byte-identical to the legacy inline emit on every single-file
|
|
|
|
|
+test and every session. Since then:
|
|
|
|
|
|
|
|
-The remaining work is purely mechanical: delete the grammar's inline
|
|
|
|
|
-emit (533 `QbeGen.*` call sites), retire the `-lower` flag and the
|
|
|
|
|
-now-degenerate byte-compare tests, then remove the dead
|
|
|
|
|
-`LowerSession`/`MaterializeGlobals` scaffolding.
|
|
|
|
|
|
|
+- the inline emit was deleted from statements, control flow,
|
|
|
|
|
+ declarations, expressions/designators, calls and `ProcHeading`;
|
|
|
|
|
+- a latent VAR-actual **note-ring bug** was found and fixed
|
|
|
|
|
+ (`RestoreSession` now clears the ring);
|
|
|
|
|
+- dead code was swept (tree-wide scan: 0 unreferenced procs);
|
|
|
|
|
+- `-lower` and the now-degenerate byte-compare tests were retired;
|
|
|
|
|
+- the **array-of-record inline length-word** bug was fixed (inline
|
|
|
|
|
+ expansion for small arrays, a generated run-time init for large ones);
|
|
|
|
|
+- **statement-context result suffixes** (`F()^.x := e`) were added.
|
|
|
|
|
|
|
|
## TL;DR
|
|
## TL;DR
|
|
|
|
|
|
|
|
- **The compiler works and self-hosts today.** `run_tests.sh` is
|
|
- **The compiler works and self-hosts today.** `run_tests.sh` is
|
|
|
- **204/204** and `bootstrap/fixpoint.sh` is **FIXPOINT OK**
|
|
|
|
|
- (3,553,701 bytes, byte-identical stage2/stage3).
|
|
|
|
|
-- The **two-phase refactor (L0–L7) is done**: `Lower` reproduces the
|
|
|
|
|
- whole compiler image byte-for-byte from the AST, so flipping the
|
|
|
|
|
- emitter was a no-op.
|
|
|
|
|
-- **Lower is the only active emitter.** The grammar's inline emit is
|
|
|
|
|
- retained but suppressed; deleting it (and the `-lower` test flag) is
|
|
|
|
|
- the remaining cleanup.
|
|
|
|
|
|
|
+ **184/184** and `bootstrap/fixpoint.sh` is **FIXPOINT OK**
|
|
|
|
|
+ (3,392,601 bytes, byte-identical stage2/stage3).
|
|
|
|
|
+- The **two-phase refactor (L0–L7) is done**: `Lower` emits the whole
|
|
|
|
|
+ session from the AST and is the only active emitter.
|
|
|
|
|
+- What remains is cleanup (delete the last suppressed writers +
|
|
|
|
|
+ `SaveSession`/`SetNoEmit`), language coverage (`GOTO`, generics,
|
|
|
|
|
+ chained post-call calls), and robustness — see "What remains" below.
|
|
|
|
|
|
|
|
## What the refactor actually is
|
|
## What the refactor actually is
|
|
|
|
|
|
|
@@ -189,7 +190,7 @@ latent resolutions in the compiler's own image (fixpoint size moved).
|
|
|
```sh
|
|
```sh
|
|
|
cd compiler
|
|
cd compiler
|
|
|
./build.sh # rebuild
|
|
./build.sh # rebuild
|
|
|
-./run_tests.sh # 204/204
|
|
|
|
|
|
|
+./run_tests.sh # 184/184
|
|
|
cd ..
|
|
cd ..
|
|
|
bootstrap/fixpoint.sh # FIXPOINT OK
|
|
bootstrap/fixpoint.sh # FIXPOINT OK
|
|
|
```
|
|
```
|