feat(v4): every word but the ten is called, so it can be checked

Plan 2026-10-20 (ENGINE step 4), Task A2, for #189. Captain Bob,
2026-11-13: "The ten"; "Accept it".

- compile.f18 (COMPILE,): a word is copied in line only when it is flagged
  in-line and compile-only (24) -- the ten that work on the return stack,
  >R R> R@ I J LEAVE and the later UNLOOP 2>R 2R> 2R@. Every other word,
  in-line ones too, is a call the hook at `call` sees.
- EXECUTE calls the xt: `call xt` (opcode 3, slot 0) and a ; in (EXEC),
  run. INTERPRET runs a word by (GO): `call xt` and `jump (IL)` in
  (RUNX), entered by a jump, at the old return-stack depth.
- host_map.h: (EXEC) BUF0_W-22, (RUNX) BUF0_W-115, from what was free.
- Its cost, accepted: one return entry at the bottom of a chain (30 deep
  from the prompt, not 31) and one per explicit EXECUTE while its word
  runs; the hosted boot +2.4% (2.917 s to 2.987 s), instructions +0.4%.
- Tests first (logs/20261113-045122/a2): inline_words_are_called,
  residue_stays_inline, execute_passes_the_hook, rstack_kept_across_call,
  abandoned_definition_not_called -- 3 of 1096 failed before. The depth
  checks moved to the new figures; SEE shows the calls; two layout checks
  use in-line test words; 2>R 2R@ 2R> checked in test_host_quit.
- DECOMPOSITION.md EXECUTE, the plan's A2 and rulings, FABRIC-3 XLVIII.22.

Suite: test, test-32 99 programs 0 failures; v4-checks 79 under the
sanitizers 0 failures, the hosted builds alike; hosted POST 539/539.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 05:30:10 +00:00
parent bacb7b0616
commit 892e3889f5
14 changed files with 197 additions and 38 deletions
+24
View File
@@ -6601,3 +6601,27 @@ and memorize frequently so we can pick up where we left off").
config (`physics_execution_hooks.c`, `kernel/src/vm/vm_core.c`).
`ssm_jacquard.h` says what is wired, bit by bit; `v3/CLAUDE.md` and the L8 reference corrected.
- **Seen to pass:** both tests; v4 does not read the rolling window, so acceptance is unchanged.
### 22. #189: v4's physics, the first of it -- the hook at `call`, HEAT-OP, every word called (2026-11-12/13)
- **Found** (2026-11-12, wiring #188): v4 -- what every acceptance boot runs -- has no Compudynamics
beyond a count per opcode and the anti-clock, which nothing read; the rolling window, decay,
pipelining, inference, L8 and the heartbeat are v3's alone (`V3-PARITY.md` 2.2, 2026-10-07, never a
release blocker). Captain Bob: "That's a critical finding that blocks alpha.0" -- it blocks the alpha.5
release; #189. The way is the plan of 2026-10-20 (`docs/v4.0.0/plans/2026-10-20-engine-step4-node-in-
the-vms-place.md`), ruled then: Part A, Phases 1, 2, then 7 ("A, 1, 2, then 7").
- **A1, the hook at `call`:** `v4/src/exec.c` calls whoever runs the node at every `call`, after the
return address is pushed; the engine's per-call-target table, which counted no capsule word, is gone.
- **HEAT-OP** ("Add HEAT-OP. If it's a huge performance hit, we'll revert it"; a full array):
`HEAT-OP[0..31]` and `ANTICLOCK`, 33 read-only registers at word 13824, read by `HEAT-OP@` and
`ANTICLOCK@`. No measurable cost (the hosted boot's median, 3.734 s then 3.731 s): it stands.
- **A2, every word called:** the compiler copies in line only the ten words that work on the return
stack ("The ten": `>R R> R@ I J LEAVE` and the later `UNLOOP 2>R 2R> 2R@`, by their flags); every
other word is a call the hook sees. `EXECUTE` calls the xt through a two-cell `call`/`;`, and the
interpreter through `(GO)`, whose second cell jumps back into its loop. Its cost ("Accept it"): one
return entry at the bottom of a chain, and one per explicit `EXECUTE` while its word runs; the
hosted boot +2.4% (2.917 s to 2.987 s), instructions +0.4%. `SEE` shows the calls.
- **Tested first, seen to fail:** the hook (`test_exec.c`), the registers (`test_node.c`,
`test_host_quit.c`), A2's five (`test_host_compile.c`); the depth checks moved to the new figures.
- **Next:** Phase 1 -- v4 in the kernel's boot, the Stadium and the heartbeat started; then Phase 2,
the word accounts at `call`; then Phase 7, the loops on them.
+1 -1
View File
@@ -723,7 +723,7 @@ it, `xt + 1`; for any other word the parameter field is the code itself.
| Word | Fate | Notes |
| --- | --- | --- |
| `(` `\` | CC | `(` is `41 WORD drop`; `\` is `SPAN @ >IN !`. In `v4/capsule/input.v4` under the names `PAREN` and `BACKSLASH`. Executed on the golden model's host node (2026-10-04). |
| `EXECUTE` | CAP | `push ;` (tail-jumps to the xt; the xt returns to `EXECUTE`'s caller). Executed on the golden model's host node (2026-10-04). |
| `EXECUTE` | CAP | ~~`push ;` (tail-jumps to the xt; the xt returns to `EXECUTE`'s caller). Executed on the golden model's host node (2026-10-04).~~ **2026-11-13 (#189, ruled 2026-10-20: "`EXECUTE` calls the xt"):** a `call xt` instruction word -- opcode 3 in slot 0, the address in the 27 bits below -- is put in `(EXEC)` with a `;` after it, and run; the xt returns to the `;`, which returns to `EXECUTE`'s caller, and the hook at `call` sees it. It costs one return entry while the xt runs (Captain Bob: "Accept it"). The interpreter runs a word the same way, by `(GO)`, whose second cell jumps back into its loop, at no cost in return entries. |
| `NOP` | OP | `nop` |
| `QUIT` | CC | FORTH-79; source in `v4/capsule/quit.v4`. Clears the return stack, sets execution mode, returns control to the terminal; no message. It is the prompt: after a new line it prints `ok> `, reads a line with `QUERY`, clears `NODE-ERROR`, runs `INTERPRET`, prints ` ok` — or, if `NODE-ERROR` is set, ends any definition that was open and prints ` ERROR` — and goes round again, for as long as the node runs. The text is v3's. The line is not sent back; the terminal shows what is typed. It empties the return stack first, by a store to `RSTACK-DEPTH` (D-16), so it works from however deep, with the return stack full. The data stack is left alone. A definition open when `QUIT` runs is ended and stays hidden. Executed on the golden model's host node (2026-10-04): the node is started at `QUIT`, fed characters and its output read, including 16 sessions recorded from the v3 binary. v3's `QUIT` goes on with the rest of the line and cannot be compiled into a definition. |
| `ABORT` | CC | FORTH-79; source in `v4/capsule/quit.v4`. As `QUIT`, and it empties the data stack too (a store to `DSTACK-DEPTH`, D-16); the line it stops ends with ` ok`, as v3. Executed on the golden model's host node (2026-10-04), from six calls down and from inside two loops, forty times over, including transcripts of the v3 binary. |
@@ -179,10 +179,16 @@ acceptance. Only Part A is written in tasks below; it does not depend on Q1 to Q
**Interfaces:** Consumes A1's hook (the test sets it to observe).
- [ ] **Step 1: Failing tests** `inline_words_are_called` (for each callable in-line word of `V3-PARITY.md` 1f, a definition using it produces a call the hook sees), `residue_stays_inline` (`>R R> R@ I J LEAVE` compile in line), `execute_passes_the_hook` (`' DUP EXECUTE` seen once; Review Focus 1, from inside a definition that goes on after), `rstack_kept_across_call` (Review Focus 2), `abandoned_definition_not_called` (Review Focus 4).
- [ ] **Step 2:** Run — FAIL.
- [ ] **Step 3:** The compiler's in-line table becomes the six; `EXECUTE` calls the xt. Regenerate the maps (`make -C v4 sysmap`).
- [ ] **Step 4:** Suite passes; POST 538/538; record the new `dict_hash` (equal at both widths' products as before).
- [x] **Step 1: Failing tests** `inline_words_are_called` (for each callable in-line word of `V3-PARITY.md` 1f, a definition using it produces a call the hook sees), `residue_stays_inline` (`>R R> R@ I J LEAVE` compile in line), `execute_passes_the_hook` (`' DUP EXECUTE` seen once; Review Focus 1, from inside a definition that goes on after), `rstack_kept_across_call` (Review Focus 2), `abandoned_definition_not_called` (Review Focus 4).
- [x] **Step 2:** Run — FAIL.
- [x] **Step 3:** The compiler's in-line table becomes the six; `EXECUTE` calls the xt. Regenerate the maps (`make -C v4 sysmap`).
**Ruled 2026-11-13 (Captain Bob): "The ten"** -- four later words also work on the return stack
(`UNLOOP 2>R 2R> 2R@`, `words.f18`, `forth.f18`) and stay in line with the six: every word flagged
in-line *and* compile-only (24), decided by the flag. **And "Accept it"**: a call at the bottom of a
chain costs one return entry (words nest from the prompt 30 deep, not 31, at 32 entries), and each
explicit `EXECUTE` one while its word runs (recursion through `EXECUTE` gets half as deep). The
interpreter runs a word by `(GO)` (`compile.f18`), at the old depth.
- [x] **Step 4:** Suite passes; POST 538/538; record the new `dict_hash` (equal at both widths' products as before). (POST is 539 since #190.)
- [ ] **Step 5:** Full acceptance (three boots, test-32; boot times before and after, Review Focus 5); commit `feat(v4): every word but the six is called, so it can be checked`, then the logs.
Phase 1's plan is written when Part A is accepted and Q1 to Q5 are ruled.