Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eecf0d2d7 | ||
|
|
65737e282f | ||
|
|
a9a8687fa5 | ||
|
|
43f8687f70 | ||
|
|
0522d77337 | ||
|
|
27ab2bce1e | ||
|
|
41befb0294 | ||
|
|
9039ce836d | ||
|
|
0a0be0cafd | ||
|
|
adcfadb7f7 | ||
|
|
1990a40f09 | ||
|
|
40e9773885 | ||
|
|
f7769c0e93 | ||
|
|
cf2a321807 | ||
|
|
0684cd8362 | ||
|
|
7cfcbf2b68 | ||
|
|
3945d3964a | ||
|
|
7422dc5319 | ||
|
|
33bd835474 | ||
|
|
998510757a | ||
|
|
bd8997ffdf | ||
|
|
dc3803ab47 | ||
|
|
84f119a1b3 | ||
|
|
d6b894769c | ||
|
|
cad8291478 | ||
|
|
57f556e645 | ||
|
|
9b114fff83 | ||
|
|
a1b26eacaf | ||
|
|
daf614285a | ||
|
|
4d64e677f5 |
+4
-1
@@ -315,7 +315,10 @@ for its tree -- any change outside the evidence after the run is stale, and the
|
||||
again. **One stage per foreground command is also a protocol**, and is how an agent runs it (the
|
||||
QEMU rule: never in the background): `scripts/nightly.sh protocol accept-amd64`, then
|
||||
`accept-aarch64`, `accept-riscv64`, `accept-stick-high`, `test-32`, `proofs`, `images`, `docs`,
|
||||
each its own command, then `scripts/nightly.sh protocol-report`. The tools: `make
|
||||
each its own command, then `scripts/nightly.sh protocol-report`. **While a PR is open, commit locally and
|
||||
push once** (#152, 2026-11-08): Gitea redoes the PR's patch test and diff statistics on every push to its
|
||||
branch, and a burst of pushes with large log directories took it to 1.75 GiB. Its `app.ini` diff limits
|
||||
(`MAX_GIT_DIFF_LINES` 300, `MAX_GIT_DIFF_FILES` 30) stop a runaway diff; one push keeps it to one test. The tools: `make
|
||||
ARCH=amd64,aarch64,riscv64 init`, plus the HOL-Library heap the CI image has (`ci/runner-image`).
|
||||
|
||||
**v4 is the default build (Captain Bob, 2026-10-14: "v4 is the default build ... no, qemu to v4
|
||||
|
||||
@@ -20,6 +20,17 @@ config ENABLE_HOTWORDS_CACHE
|
||||
migration exists to collapse to one source of truth. Set to y
|
||||
to enable; also gates L8 Jacquard's L1_heat_tracking bit.
|
||||
|
||||
config WORD_PHYSICS
|
||||
bool "Compudynamics on a v4 node's words: the loops at call and at each tick (WORD_PHYSICS)"
|
||||
default y
|
||||
help
|
||||
#189 Phase 7 Task 9 (Captain Bob, 2026-11-20, "A Kconfig switch"): a
|
||||
word's heat, its decay, the rolling window, pipelining, inference and
|
||||
L8, run by the kernel at every call and at every heartbeat tick. Off,
|
||||
a word's calls are still counted and charged to the Stadium, and none
|
||||
of the loops runs: the boot the acceptance checks are seen to fail
|
||||
on. The revert, as OPCODE_PHYSICS is the opcodes'.
|
||||
|
||||
config OPCODE_PHYSICS
|
||||
bool "Compudynamics on the 32 F18 opcodes as well as the words (OPCODE_PHYSICS)"
|
||||
default y
|
||||
|
||||
+22
-15
@@ -29,10 +29,12 @@
|
||||
| `sdk.4th` | 5109, 5110, 5111, 5112, 5113, 5114, 5115 | `0x008fdbbb62c94a3a` | n/a |
|
||||
| `turtle.4th` | 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108 | `0x4d470418ca543365` | n/a |
|
||||
| `user-font-demo.4th` | 4200, 4201, 4202 | `0xce1fd7d1b581a56d` | n/a |
|
||||
| `v4:centre.4th` | 3964, 3965, 3966, 3967, 3968, 3969, 3970 | `0xea5815290d56dff3` | n/a |
|
||||
| `v4:ACL.4th` | 3984, 3985, 3986, 3987 | `0xdba5690fb0ee12a4` | n/a |
|
||||
| `v4:centre.4th` | 3964, 3965, 3966, 3967, 3968, 3969, 3970 | `0x53b1e3df644e8e25` | n/a |
|
||||
| `v4:forth79.4th` | 3948, 3949, 3950 | `0x4609d6ef54166ef8` | n/a |
|
||||
| `v4:hera.4th` | 3960, 3961 | `0x78730b1d6effe892` | n/a |
|
||||
| `v4:physics.4th` | 3972, 3973, 3974, 3975, 3976 | `0x5b0195fc30828bde` | n/a |
|
||||
| `v4:init.4th` | 3980 | `0x13fe8932fa4d2934` | n/a |
|
||||
| `v4:physics.4th` | 3972, 3973, 3974, 3975, 3976 | `0xb26da18d35ce5a84` | n/a |
|
||||
| `v4:starshipos.4th` | 3956, 3957 | `0x1734a8f4fe7483a5` | n/a |
|
||||
| `workload-0.4th` | 2200, 2201 | `0x93f86f60aeba8feb` | n/a |
|
||||
| `workload-1-lite.4th` | 5058, 5059 | `0x44a7a7e3176dcc8d` | n/a |
|
||||
@@ -112,18 +114,23 @@
|
||||
| 3957 | `v4:starshipos.4th` | `0x1734a8f4fe7483a5` | ok |
|
||||
| 3960 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3961 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3964 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3965 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3966 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3967 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3968 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3969 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3970 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3972 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3973 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3974 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3975 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3976 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3964 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3965 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3966 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3967 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3968 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3969 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3970 | `v4:centre.4th` | `0x53b1e3df644e8e25` | ok |
|
||||
| 3972 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3973 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3974 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3975 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3976 | `v4:physics.4th` | `0xb26da18d35ce5a84` | ok |
|
||||
| 3980 | `v4:init.4th` | `0x13fe8932fa4d2934` | ok |
|
||||
| 3984 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3985 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3986 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 3987 | `v4:ACL.4th` | `0xdba5690fb0ee12a4` | ok |
|
||||
| 4000 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4001 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4002 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
@@ -387,4 +394,4 @@
|
||||
| 5115 | `sdk.4th` | `0x008fdbbb62c94a3a` | ok |
|
||||
|
||||
---
|
||||
*40 capsule(s) scanned. Re-run `mkcapsule --manifest <dir>` to refresh.*
|
||||
*42 capsule(s) scanned. Re-run `mkcapsule --manifest <dir>` to refresh.*
|
||||
|
||||
@@ -23,6 +23,8 @@ Block 3973
|
||||
-32 KERNEL-WORD INFER-VARIANCE@ ( -- d )
|
||||
-33 KERNEL-WORD INFER-FIT@ ( -- d )
|
||||
-34 KERNEL-WORD INFER-EARLY-EXIT@ ( -- flag )
|
||||
-41 KERNEL-WORD L8-CARD@ ( -- card changes )
|
||||
-42 KERNEL-WORD L8-HOLD ( card -- ; -1: L8 chooses )
|
||||
( v3's DECAY_RATE_PER_US_Q16, its compile-time constant )
|
||||
1 CONSTANT DECAY-RATE@
|
||||
-->
|
||||
|
||||
@@ -208,6 +208,8 @@ IS ( xt -- ) IS xxx: make the deferred word xxx run xt; compiled when compiling.
|
||||
J ( -- n ) Compile-only: the index of the next outer DO loop.
|
||||
KERNEL-WORD ( n -- ) KERNEL-WORD xxx: define xxx, a word that asks the kernel to do request n (as BYE, BLOCK).
|
||||
KEY ( -- c ) Wait for a key and leave its character.
|
||||
L8-CARD@ ( -- card changes ) L8's current card on this node, 0 to 63, and how many times it has changed: more than 0 once L8 has run.
|
||||
L8-HOLD ( card -- ) Holds L8 on the card given, 0 to 63, its gates applied; -1 lets L8 choose again.
|
||||
LATEST ( -- xt ) The newest entry of the CURRENT vocabulary.
|
||||
LEAVE ( -- ) Compile-only: leave the innermost DO loop at its next LOOP or +LOOP.
|
||||
LFA ( xt -- addr ) The link field of the entry (>LINK).
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 3.
|
@@ -176,6 +176,9 @@ capsule-blocks.md` §5), and Artemis keeping what is kept (ruling 3).
|
||||
the train it imports from: (its capsule hash, the word's name). If that train is rebuilt or updated,
|
||||
its hash changes, so its importers are rebuilt too, and a live update replaces the whole dependent set
|
||||
of trains together. Placement refuses an import whose hash is not present.
|
||||
**Ruled 2026-11-19 (step 3, `plans/2026-11-19-f18-artifact-build.md` §10.4):** a train's hash is its
|
||||
`.f18a`'s capsule ID. The nucleus has none, so a word imported from it has hash 0 and is resolved by name
|
||||
in the node's dictionary at placement; exact hashes hold between artifact trains only.
|
||||
5. ~~How callers reach a replacement~~ **Ruled 2026-11-19: "Jump at the old entry".** At activation, each
|
||||
replaced word's first code cell, at its xt, is overwritten with a `jump` to the new word: one cell per
|
||||
word, and every caller, compiled at run time or not, follows at once. The old code stays in place,
|
||||
|
||||
@@ -67,6 +67,12 @@ Each hash is SHA-512 (choice 2).
|
||||
| 32–47 | the build configuration's hash: the knobs that change code, the cell width, `V4_NODE_WORDS`, the rings |
|
||||
| 48–63 | the ROM's hash it must agree with: the tool's output is checked against the ROM's assembly |
|
||||
|
||||
**How each hash is taken** (ruled 2026-11-20, "Keep as drafted": plan 2026-11-19-f18-artifact-build §11,
|
||||
choices 1 and 2). Each input is framed as its name, a NUL, its length in 8 bytes low first, then its
|
||||
bytes, so two inputs cannot run together. The tool's hash covers its own sources and every `include/v4`
|
||||
header, in a fixed order. The configuration's covers the sizes as text, framed as `config`, then the map.
|
||||
The ROM's covers the ROM file. `v4/tools/f18a.h` names the files.
|
||||
|
||||
## 5. Exports, imports, relocations
|
||||
|
||||
**An export (8 units):**
|
||||
@@ -145,6 +151,10 @@ about the format:
|
||||
its list. Compatibility refuses a replacement that needs one the old did not (`ABI.md` §7). The list
|
||||
is a count unit then that many request numbers (§7). The bit layout and the list's form were chosen in
|
||||
drafting; confirmed by Captain Bob, 2026-11-19 ("Yes").
|
||||
**Changed 2026-11-19 (step 3, `plans/2026-11-19-f18-artifact-build.md` §10.5, "Declared, then checked"):**
|
||||
v4 has no port opcode, so capabilities cannot be derived. Each word declares them (`ports`, `request N`),
|
||||
and the tool fails the build where it can see a port or a request that is not declared. The layout is
|
||||
unchanged.
|
||||
5. ~~Endianness for the code cells~~ **Ruled 2026-11-19: "Low-first, like the records".** Every byte of
|
||||
the artifact has one order, low byte first, so its hashes and signature are the same whichever host
|
||||
built it. A big-endian host swaps the bytes when it places the code.
|
||||
|
||||
+4
-2
@@ -6,7 +6,7 @@ the standard first -- FORTH-79, FORTH-83, ANS 1994 -- then v3's table, not v3's
|
||||
The cases are `v4/system/post_cases.c`; those of the words `capsules/v4/physics.4th` defines
|
||||
need the kernel and are not run by the hosted product.
|
||||
|
||||
POST runs 990 cases. 783 are v3's, with what the hosted v3 binary did as the
|
||||
POST runs 992 cases. 783 are v3's, with what the hosted v3 binary did as the
|
||||
expected result. This file lists every other case, and why.
|
||||
|
||||
## 1. Rewritten: the standard's result, or v3's table's (159)
|
||||
@@ -206,7 +206,7 @@ printed unless an address is printed; the values are not.
|
||||
| `LIST.basic` | `1 LIST` | values left only |
|
||||
| `SCR.after_list` | `1 LIST SCR @ . CR` | values left only |
|
||||
|
||||
## 3. Written by hand (28)
|
||||
## 3. Written by hand (30)
|
||||
|
||||
For required words v3 has no case for. The expected results are the
|
||||
standard's; no v3 run stands behind them.
|
||||
@@ -241,6 +241,8 @@ standard's; no v3 run stands behind them.
|
||||
| `WORD.delimiter` | `: W2 44 WORD COUNT TYPE ; W2 A B,` | stack `empty`, prints `A B` |
|
||||
| `WORD.count` | `: W3 BL WORD C@ . ; W3 ABC` | stack `empty`, prints `3 ` |
|
||||
| `WORD.skips_leading` | `: W4 BL WORD COUNT TYPE ; W4 X` | stack `empty`, prints `X` |
|
||||
| `L8-CARD@.basic` | `L8-CARD@ 0< . 64 U< . CR` | stack `empty`, prints `0 -1 \n` |
|
||||
| `L8-HOLD.basic` | `18 L8-HOLD L8-CARD@ DROP . -1 L8-HOLD CR` | stack `empty`, prints `18 \n` |
|
||||
|
||||
## 4. v3 cases left out (52)
|
||||
|
||||
|
||||
@@ -515,6 +515,23 @@ it.
|
||||
- There is no decay, rolling window, pipelining, inference, L8, heartbeat
|
||||
or Stadium wire on the node.
|
||||
|
||||
*Corrected 2026-11-20 (#189; ENGINE step 4 Phase 7, `plans/2026-11-13-engine-step4-phase7-the-loops-and-parity.md`).*
|
||||
Section 2.2 was true of the lone node of 2026-10-07. It no longer is of v4 in its place in the system. The
|
||||
kernel keeps every word's record (Phase 2) and runs v3's loops on it, at `call` and on the one heartbeat
|
||||
(Phase 7, Tasks 1 to 4):
|
||||
- L1: heat;
|
||||
- L2: the rolling window;
|
||||
- L3: decay, on touch and in the background;
|
||||
- L4: pipelining and the hot-words cache, behind `ENABLE_PIPELINING` and `ENABLE_HOTWORDS_CACHE`, off as in v3;
|
||||
- L5 and L6: inference;
|
||||
- L7: the adaptive heartbeat, the kernel's one heartbeat (2026-11-17);
|
||||
- L8: the Jacquard selector.
|
||||
|
||||
The loops also run on the 32 opcodes (`OPCODE_PHYSICS`). The words of `physics.4th` read and set them, among
|
||||
them `L8-CARD@` and `L8-HOLD` (Task 9). Each acceptance boot asserts L1, L3, L2 with L5, and L8 at the
|
||||
prompt (`scripts/qemu_session.py`, `loops()`), and `WORD_PHYSICS=0`, the revert, fails acceptance at POST.
|
||||
The call-target count of `heat.c` described above is still there, beside the kernel's records.
|
||||
|
||||
### 2.3 What the v4 design documents say
|
||||
|
||||
The documents ruled on 2026-10-01 do not say "as v3". They say:
|
||||
|
||||
@@ -213,8 +213,58 @@ Phase 4).
|
||||
**Done 2026-11-14** (`POST-PARITY.md` section 6): 990 cases, all pass on Hera; each case rewritten is
|
||||
listed with its reason in `POST.md`; the floor (`v4/system/POST_FLOOR`) is 990.
|
||||
### Task 9: acceptance -- the full protocol; ENGINE.md, V3-PARITY.md, FABRIC-3
|
||||
**Designed 2026-11-20, for ruling** (#189's last two items: "Acceptance asserts it on the three architectures
|
||||
and the stick -- a boot without the physics fails", and "V3-PARITY.md section 2 and #4 say what is now
|
||||
built"). Nothing here is built.
|
||||
|
||||
Each task gets its steps when the one before it is accepted, test first, as Phase 2's did.
|
||||
What a boot shows today: the heartbeat ticking, the Stadium conserved, Hera's words admitted after POST
|
||||
(`scripts/qemu_session.py`, every acceptance boot). Nothing there fails if a word's heat, its decay, the
|
||||
window, inference or L8 did not run: those are seen in `test_mesh_boot` on the host only.
|
||||
|
||||
The words of Task 4 read them at the prompt, on the real boot, so the session can ask. The steps:
|
||||
1. **Test first: a build without the physics.** `OPCODE_PHYSICS=0` takes out only the opcodes' loops, so
|
||||
it is not the case. The check is seen to fail on a boot whose per-call hook does nothing: a
|
||||
one-line stub, in a diagnostic build only, never committed in the tree that ships.
|
||||
2. **The checks, in the v4 session of `qemu_session.py`,** after the prompt, each a line typed and its
|
||||
answer matched:
|
||||
- L1, heat: a word defined and called three times. `' W HEAT@ .` is more than 0.
|
||||
- L3, decay: `HEAT!` sets a word's heat; after a set number of heartbeat ticks, `HEAT@` is less.
|
||||
- L2 and L5, the window and inference: after a workload, `INFER-RUN INFER-WINDOW@ .` is not 0.
|
||||
- L8: no word reads the card today. See the open questions.
|
||||
Each value is measured on the three architectures first, and the matches are written from what the
|
||||
boots print, not guessed.
|
||||
3. **The record:** `V3-PARITY.md` section 2.2 corrected, dated, to what is built (it says "There is no
|
||||
decay, rolling window, pipelining, inference, L8, heartbeat or Stadium wire on the node"), and #4 told.
|
||||
4. **The protocol** on the result: four boots, test-32, the proofs, the images, the documents.
|
||||
|
||||
**Ruled 2026-11-20, one at a time:**
|
||||
1. **The loops asserted: "L1, L3, L2/L5, L8".** Heat, decay, the window and inference, and L8: every loop v4
|
||||
carries, seen on the real boot on the three architectures and the stick. Asked: those, or a smaller set
|
||||
with the rest left to `test_mesh_boot`.
|
||||
2. **L8: "A word, L8-CARD@".** A kernel request, as Task 4's words are, in `physics.4th`. It leaves the node's
|
||||
current card number. It gets a POST case, and the session checks that it is one of the table's cards
|
||||
after a workload. Asked: a word, a line the kernel prints, or L8 left to the host test.
|
||||
**2a, ruled 2026-11-20: "L8-CARD@ leaves card and changes".** `( -- card changes )`. The check is that the
|
||||
card is one of the table's and that changes is more than 0 after a workload. The card alone could not
|
||||
fail: L8 starts on card 8, and with the physics off it never runs, so the card stays 8, which is one of
|
||||
the table's. With the physics on, UCB1 tries each untried card once, and the kernel counts each change
|
||||
(`v4_mesh_l8.changes`).
|
||||
3. **The boot without the physics: "A Kconfig switch".** `WORD_PHYSICS` (default y), beside `OPCODE_PHYSICS`,
|
||||
turns the per-call and per-tick word loops off. It is a real revert, as ruling 7's is. The session's
|
||||
checks are seen to fail on `WORD_PHYSICS=0`, and pass on the boot as built. Step 1 above, the stub, is
|
||||
replaced by this. Asked: that, or a one-off stub in a diagnostic build.
|
||||
**3a, ruled 2026-11-20: "POST's failure is enough".** A `WORD_PHYSICS=0` boot fails acceptance at POST
|
||||
(amd64, `logs/20261120-task9/amd64-nophysics.txt`): its `ENTROPY@` cases need a word's heat. So it
|
||||
never reaches the prompt, and every loop check fails with it, but not one at a time. The checks are
|
||||
then measured and passed on the boot as built. Nothing in POST changes. Asked: that, POST's physics
|
||||
cases skipped under `WORD_PHYSICS=0`, or each loop failed by holding L8 on cards that turn it off.
|
||||
**The L2/L5 check, measured 2026-11-20** (taken as recommended: Captain Bob, "Yes go on"). On amd64,
|
||||
as built, `INFER-WINDOW@` was 0. Every loop but L1 is gated by L8's current card, and L5's width is
|
||||
computed only on ticks whose card has L5 on, so on a real boot it may or may not be set. The check is
|
||||
instead that `INFER-RUN INFER-VARIANCE@` is not 0 after the workload: the variance is computed whenever
|
||||
the window holds calls, whatever the card, and stays 0 with no window. That is L2's window with the
|
||||
engine run on it. The width is printed beside it, not checked; L5's width stays in `test_mesh_boot`,
|
||||
where L8 is held on a card. The same boot: L1 H=6, L3 1000 cooled to 0 in 40 s, L8 65 changes on card 11.
|
||||
|
||||
## Review focus
|
||||
|
||||
|
||||
@@ -145,3 +145,254 @@ accepted before the next:
|
||||
3. `mkf18a` and `make -C v4 artifacts` (test 3).
|
||||
4. The small train, placed at a base other than 0 (test 5).
|
||||
5. The nucleus renamed to name order (3a), designed first: it changes the boot, so the protocol runs.
|
||||
|
||||
## 8. Task 1 built (2026-11-19): `text.c`'s address record
|
||||
|
||||
**What changed:**
|
||||
- `text.h` and `text.c`: `v4_text_record(t, buf, cap)` turns the record on, and `v4_text_addresses(t)` says
|
||||
how many were recorded. Each entry is a cell and its slot, 0–3 for a branch field or 7
|
||||
(`V4_TEXT_WHOLE_CELL`) for the whole cell. What is recorded:
|
||||
- every branch, to a word or a label, back or forward, including `NEXT`'s;
|
||||
- an `&NAME` literal in code, and `#, &NAME`;
|
||||
- `here`, and a `set` variable that holds an address, wherever it is laid down (code, `#,`, `store`);
|
||||
- a header's name cell, and its link when there is an entry before it.
|
||||
|
||||
The map's constants and plain numbers are not recorded. A full record is an error. With the record off,
|
||||
nothing changes.
|
||||
- **Found while building:** the nucleus lays its headers down with `set HDR-NFA here ... #, HDR-LINK`, not
|
||||
with `header`. So a `set` variable carries whether it holds an address, or those links would be missed.
|
||||
|
||||
**Test first** (`logs/20261119-text-record/`):
|
||||
- `test_text`: 15 new checks. Before the change, 13 failed: every one that expects an address recorded.
|
||||
The two that expect nothing passed, as they should. Two errors in the tests themselves were fixed before
|
||||
the change: `source` needs its `N-1` constant, and the notation is `FOR ... NEXT`, upper case.
|
||||
- `test_host_rom_nucleus`, with the record on (test 4). On the system's source it records 1825 branches
|
||||
and 664 whole cells. Every whole cell holds an address of the assembly, and the ROM's assembly is still
|
||||
equal to it word for word, at both widths. This check could not be seen to fail before: the record did
|
||||
not exist. It guards that the record changes no cell.
|
||||
|
||||
**Verified:**
|
||||
- `make -C v4 test` passes: all tests at both widths, and the three mesh boots with POST 990/990.
|
||||
- `make -C v4 test-32` passes.
|
||||
- ASan+UBSan passes for every test at both widths, and for the mesh boot (POST 990/990). The run hit my
|
||||
one-hour background limit at the 64-bit `test_host_mesh`, so the rest was run again from there.
|
||||
`v4-gates.txt` and `v4-sanitize-rest.txt` hold the two parts.
|
||||
- The boot does not use the record, so the kernel and the protocol are unchanged.
|
||||
|
||||
## 9. Task 2 built (2026-11-19): `effect.c`, the stack effects
|
||||
|
||||
**What it is:** `v4/include/v4/effect.h` and `v4/src/effect.c`, a build-machine analysis, not part of the
|
||||
engine or the kernel. `v4_effect_of(e, addr, how)` walks a word's code from its entry and gives what it
|
||||
takes and leaves on both stacks, or why it has none, and where. The opcode counts are the engine's own
|
||||
table (`exec.c`, D-16). Effects of called words are kept, so each is walked once. A callback gives the
|
||||
effects of code outside the range analysed: the ROM's, or another train's.
|
||||
|
||||
**Two ways a word is reached,** from the header's flag 8:
|
||||
- **Called:** it returns with `;` at its own entry depth on the return stack, so its return-stack effect
|
||||
is always 0 → 0. A `;` with its own value on the return stack is a computed jump (EXECUTE, a DEFERred
|
||||
word), and has no fixed effect. So has touching its caller's return address, and `ex`.
|
||||
- **In line:** the body runs to the first `;` wherever the return stack is. `push` in line is data 1 → 0
|
||||
and return stack 0 → 1.
|
||||
|
||||
No fixed effect: paths that meet with different depths (a loop that leaves a count of values), returns
|
||||
that disagree, recursion, a word that never returns, and a call to a word with none.
|
||||
|
||||
**Test first** (`logs/20261119-effect/`): `test_effect`, 34 checks.
|
||||
- Against a stub that derived nothing, the 23 checks that expect a fixed effect failed. The 10 that
|
||||
expect none passed vacuously.
|
||||
- Three of my expectations were wrong, and the analysis was right. I corrected them:
|
||||
- `a! @ !` is 1 → 0, not 2 → 0: the value fetched is stored back;
|
||||
- `drop jump A`, with A `dup`, is 2 → 2: `dup` needs a second cell;
|
||||
- `3 FOR dup drop NEXT` is 1 → 1: the `dup` needs a cell already there. The fixed-loop check now uses
|
||||
`5 drop`, and the 1 → 1 case is a check of its own.
|
||||
- **Five real words agree with their stack comments:** SWAP', UM/MOD, C@, C! and ROUNDTRIP (2 → 1, through
|
||||
its `jump C@`).
|
||||
|
||||
**On the nucleus** (`nucleus-dictionary.txt`, a one-off measurement): of 315 headers, 65 of them in line,
|
||||
214 have a fixed effect and 101 have none.
|
||||
- 78 call a word with no fixed effect;
|
||||
- 11 have a computed jump;
|
||||
- 8 have returns that disagree;
|
||||
- 4 touch their caller's return address.
|
||||
|
||||
Under ruling §6.4, the 214 would be the nucleus's exports. The nucleus is not an artifact (§6.2a), so
|
||||
this is a measure of the analysis, not an interface.
|
||||
|
||||
**Verified:**
|
||||
- `make -C v4 test` passes, with all three mesh boots at POST 990/990.
|
||||
- `make -C v4 test-32` passes.
|
||||
- `make -C v4 sanitize` passes: every test at both widths, and the mesh boot at POST 990/990, under
|
||||
ASan+UBSan.
|
||||
|
||||
## 10. Task 3, `mkf18a`: rulings while designing it
|
||||
|
||||
1. **Exports: "`: NAME` words, no headers"** (2026-11-19). Every `:` word with a fixed effect is exported,
|
||||
named by its `:` name. A train's source lays no dictionary entry: placement makes the entries (`ABI.md`
|
||||
§5, step 4, as written). Asked because a `header` in the code would make each entry twice.
|
||||
2. **Flags: "After the name, like header"** (2026-11-19). The flags follow the `:` name, as they follow
|
||||
`header` today: `: PLUS inline + ;`, `: [ immediate ...`. The ACL defaults come the same way, as
|
||||
`pinned` and `mode N`. `text.c` records them and lays nothing in the code. In-line also decides how the
|
||||
tool derives the word's effect (§9).
|
||||
3. **Imports: "An import line"** (2026-11-19). `import TRAIN NAME` declares NAME as from the train TRAIN,
|
||||
before it is used. The tool takes TRAIN's capsule hash, and the word's derived effects, from that train's
|
||||
build, so the build fails if TRAIN does not export NAME. Each call to NAME is a relocation to its import.
|
||||
4. **A train's capsule hash: "Its .f18a's capsule ID"** (2026-11-19). A train is identified by its engine:
|
||||
the capsule ID `mkcapsule` gives its `.f18a`. The nucleus has none (§6.2a), so a word imported from it
|
||||
is named with hash 0 and resolved by name in the node's dictionary at placement. Exact-hash imports
|
||||
(`ABI.md` choice 4) hold between artifact trains only. Asked because a capsule today is one file, and
|
||||
the nucleus is 16 blobs.
|
||||
5. **Capabilities: "Declared, then checked"** (2026-11-19). v4 has no port opcode: a port is an address,
|
||||
reached through A, B or P, whose values are data, so which words touch ports cannot be derived. A word
|
||||
declares what it needs after its name, like its flags: `ports`, `request N`. The tool records the
|
||||
declaration. Where it can see a port or a request, it fails the build if the declaration is missing:
|
||||
a literal port address put into A or B, or a kernel request with a literal number. What it cannot see
|
||||
is the declaration's. This changes `ARTIFACT.md` choice 4's "the tool derives it from the code".
|
||||
|
||||
## 11. Task 3 built (2026-11-19): `mkf18a` and `make -C v4 artifacts`
|
||||
|
||||
**What changed.**
|
||||
- `text.c` (part 1, committed first): the attributes after a `:` name (`immediate data inline compile-only
|
||||
pinned mode N ports request N`), recorded and laid nowhere in the code; `import TRAIN NAME`, whose uses are
|
||||
calls to a placeholder `V4_NODE_WORDS-1-k` and are recorded as relocations to import k. A use before the
|
||||
declaration fails, and so does code that reaches the placeholders.
|
||||
- `include/v4/artifact.h`, `src/artifact.c`: the layout of `ARTIFACT.md` and its check (§7), shared by the
|
||||
tool and, later, by placement.
|
||||
- `tools/f18a.c`, `tools/f18a.h`, `tools/mkf18a.c`: the tool, `mkf18a OUT.f18a MAP.f18 ROM DIR
|
||||
[TRAIN=PATH.f18a ...]`. It assembles the map, then DIR's `.f18` files in name order, at 0, with the record
|
||||
on (§6.3). It refuses a header, a start, and a store; resolves each import from the trains it is given;
|
||||
derives the effects (§9) and exports every `:` word that has one (§6.4, ruling 1); checks the declared
|
||||
capabilities (ruling 5); and writes the relocations, the pool and the four hashes.
|
||||
- `Makefile`: `mkf18a-32`, `mkf18a-64` and their tests; `artifacts` builds the tool at both widths. `test`
|
||||
runs `mkf18a-32/64`, `sanitize` their ASan+UBSan builds.
|
||||
|
||||
**Test first, seen to fail.** `test_text` had 11 failures of 274 checks before part 1
|
||||
(`logs/20261119-mkf18a/text-before-64.txt`), none after (`text-after.txt`). `test_mkf18a` failed at its
|
||||
first check against a stub that built nothing (`mkf18a-before-64.txt`), and passes 83 checks at both widths
|
||||
after (`mkf18a-after-64.txt`, `mkf18a-after.txt`). It builds a library train and a train that imports from
|
||||
it, reads every unit back against `text.c`, builds both twice for the same bytes, and checks ten refusals:
|
||||
of the checker, and of the tool (r1-r9 refused, r10 built).
|
||||
|
||||
**The test's own error.** A name meant to be 32 characters, to be refused, was 31 and was taken; the test
|
||||
was corrected, not the tool.
|
||||
|
||||
**Choices made in drafting.** Ruled 2026-11-20, each "Keep as drafted", one at a time:
|
||||
1. The provenance hashes frame each input as its name, a NUL, its length in 8 bytes low first, then its bytes
|
||||
(`f18a.h`).
|
||||
2. The tool's hash covers `tools/mkf18a.c`, `tools/f18a.c`, `tools/f18a.h`, `src/artifact.c`, `asm.c`,
|
||||
`effect.c`, `iword.c`, `text.c`, then every `include/v4/*.h`, in that order. The configuration hash covers
|
||||
the text `V4_CELL_BITS=.. V4_NODE_WORDS=.. V4_DATA_RING=.. V4_RET_RING=.. V4_ROM_WORDS=..`, framed as
|
||||
`config`, then the map. The ROM's is the ROM file.
|
||||
3. The pool's unit 0 is always 0, so an offset of 0 means none.
|
||||
4. A store of a literal number to `(PORT)` counts as a request, not as touching the ports.
|
||||
5. Capabilities pass through calls: a word that calls one that declares `ports` must declare it too.
|
||||
6. The imports' placeholders are the node's top words, `V4_NODE_WORDS-1-k`.
|
||||
|
||||
**Recorded, not fixed:** a store into the code below `here` is not caught by the store check, which looks
|
||||
only above `here`.
|
||||
|
||||
**Verified** (`logs/20261119-mkf18a/v4-gates.txt`, exit 0):
|
||||
- `make -C v4 test` passes, with the mesh boots at POST 990/990, and `mkf18a-64` and `mkf18a-32` at 83 checks.
|
||||
- `make -C v4 test-32` passes.
|
||||
- `make -C v4 sanitize` passes, `mkf18a` included at both widths.
|
||||
|
||||
## 12. Task 4, the small train placed: design, for ruling
|
||||
|
||||
Written 2026-11-20. Test 5 of §4: a few words of `.f18` with one import from the nucleus, built by `mkf18a`
|
||||
into a `.f18a`, placed at a base other than 0. Its words run, and its call into the nucleus reaches the
|
||||
nucleus. **Nothing here is built.** The kernel and the boot are unchanged: carrying artifacts in capsules
|
||||
and placing them on a node are the ADR's steps 4 and 6 (§3).
|
||||
|
||||
**What it needs that task 3 left out:**
|
||||
- **Imports from the nucleus.** Ruling 4 (§10) names them with hash 0, resolved by name in the node's
|
||||
dictionary. To check the import's effect at build time, the tool needs the nucleus's effects. Task 2
|
||||
derived them once, by the dictionary's names (`logs/20261119-effect/nucleus-dictionary.txt`); task 4
|
||||
makes that a part of the tool.
|
||||
- **Placement**, `ABI.md` §5: check, place at the base, fix each relocation, enter each export.
|
||||
|
||||
**The test, `test_place`, written first:**
|
||||
1. A train of two files: `: SQ dup + ;` style words, one of them calling a nucleus word with a fixed
|
||||
effect (`OVER` or the like, picked from the 214), one calling the other.
|
||||
2. `mkf18a` builds it, with the nucleus import's hash 0 and its effect from the nucleus.
|
||||
3. The host system is booted as `test_mesh_boot` boots it. The train is placed into Hera at her `HERE`,
|
||||
which is not 0. `HERE` moves past it.
|
||||
4. Console lines run the words and print their results. Each must be as the same source gives when
|
||||
typed at the prompt. Each relocated cell must hold the base plus its offset, or the nucleus word's
|
||||
address.
|
||||
5. Refusals, each leaving the node unchanged: a nucleus import the dictionary lacks; an import whose
|
||||
effect disagrees; an artifact the checker refuses; a relocation out of its slot's reach at that base.
|
||||
|
||||
**Ruled 2026-11-20, one at a time:**
|
||||
1. **Placement: "Host placer in C".** `v4/src/place.c` checks, copies, patches and enters into a host
|
||||
node's memory, in the booted host system. It is the oracle for the loader on the node (step 6). Asked:
|
||||
a host placer in C, or the loader in FORTH on the node now, pulled forward from step 6.
|
||||
2. **Entries: "Placer lays entries".** The placer lays each export's entry as `(HEADER)` lays one: the ID,
|
||||
the flags with the ACL defaults, the name, the link, the code. It tells the kernel, as `(WORD-DEFINED)`
|
||||
does. The test runs the words by name at the console. Asked: entries now, or calls by address and
|
||||
entries left to step 6.
|
||||
**2a, ruled 2026-11-20: "Split at each export".** An entry is laid right before its code (`dict.f18`:
|
||||
the four cells at xt-4 to xt-1, the code at xt), but the artifact's code is one block with no room
|
||||
between its words (ruling 1). So the placer lays each export's entry, then that export's code, up to
|
||||
the next export's entry offset. Code before the first export goes first, with no entry. Every cell
|
||||
moves by the entries laid before it, so every relocation is mapped through the moved offsets, and
|
||||
each one's reach is checked at its final address. Calls go straight to the code. A word whose code
|
||||
runs on into the next export's, with no `;` or jump between, cannot be split, and the placer refuses
|
||||
it. *Corrected 2026-11-20, ruled "In the tool": the tool refuses it, at build time, and the placer
|
||||
trusts the artifact for it. The placer cannot see it: the artifact names only the exports, and the
|
||||
word before an export may be internal, with no fixed effect. The tool knows every `:` word, and walks
|
||||
each with its range ending at the next.* Asked: that, or the whole block at the base, with an entry after it whose xt cell jumps to the word.
|
||||
3. **The nucleus's effects: "Tool assembles it".** `mkf18a` is given the nucleus's directory, assembles it
|
||||
with its map, and derives each header's effect by name, as task 2's measurement did. Nothing is
|
||||
generated in between. Asked: that, or an effects file generated once per build.
|
||||
4. **The import's name: "import nucleus NAME".** `nucleus` is a reserved train name: the import has hash
|
||||
0, its effect from the nucleus, and placement resolves it by name in the dictionary. Asked: that, or a
|
||||
directive of its own.
|
||||
|
||||
## 13. Task 4 built (2026-11-20): the small train placed
|
||||
|
||||
**What changed.**
|
||||
- `tools/f18a.c`, `mkf18a.c`: `import nucleus NAME` (ruling 4). Given `nucleus=SYSDIR`, the tool assembles
|
||||
the nucleus as the ROM does and looks NAME up by its dictionary name. The import has hash 0 and the effect
|
||||
derived there. A word in line there, or one with no fixed effect, is refused (ruling 3). The tool also
|
||||
refuses a word that runs on into the next export (2a, as corrected).
|
||||
- `include/v4/place.h`, `src/place.c`: the host placer, `v4_train_place` (rulings 1, 2, 2a). It checks
|
||||
everything before it writes anything. Then it places the code at HERE, split at each export with the
|
||||
export's entry laid before its code, fixes each relocation at its moved address, enters each export into
|
||||
CURRENT's vocabulary, moves DP, and tells the kernel of each xt.
|
||||
- `tests/train-place/`: the small train, two files. `DIST` calls the nucleus's `ABS`; `DIST2` calls `DIST`;
|
||||
`CLAMP0` has a forward branch; `ADDR` holds `&DIST`. The Makefile builds its `.f18a` with `mkf18a-64`
|
||||
itself.
|
||||
- `tests/test_mesh_boot.c`: the system is booted, and the train is placed on Hera at her HERE (9782).
|
||||
- `Makefile`: the train's rule. The mesh boot's four builds link the placer. `test_mkf18a` is built with the
|
||||
host node's size, as the tool is: the nucleus did not fit a mesh node's.
|
||||
|
||||
**Test first, seen to fail.**
|
||||
- `test_mkf18a`, nucleus imports: 3 of 88 checks failed against a stub (`logs/20261120-place/nucleus-before-64.txt`).
|
||||
93 passed after.
|
||||
- The run-on refusal failed first (`runon-before-64.txt`). Now 95 pass at both widths.
|
||||
- `test_mesh_boot`: 16 new checks failed against a stub placer (`place-before.txt`). Now 141 pass (`place-after.txt`).
|
||||
|
||||
What the placement checks:
|
||||
- the words run by name: `7 3 DIST .` and `3 7 DIST .` give 4, `DIST2` 8, `CLAMP0` 0 and 5;
|
||||
- `ADDR` equals `' DIST`;
|
||||
- a word compiled at the prompt calls a placed one;
|
||||
- the kernel keeps a record of each export;
|
||||
- six refusals each leave Hera unchanged: a wrong magic, another node size, a name the dictionary lacks, an
|
||||
effect not the one expected, an import from a train, and no room below DLIMIT.
|
||||
|
||||
**The test's own error.** Its `defined` callback first only kept the xts, and did not tell the kernel. The
|
||||
test was corrected to run the word in `(WORD-DEFINED)` with each xt, as `(DEFINED)` does. The placer was
|
||||
not changed.
|
||||
|
||||
**Choices made in building, for ruling:**
|
||||
1. An import from the nucleus declares no capabilities: the nucleus declares none.
|
||||
2. The placer looks an import up in FORTH, from `(LATEST)`, skipping hidden entries, and enters the exports
|
||||
into CURRENT's vocabulary.
|
||||
3. An import from an artifact train (a hash that is not 0) is refused for now, "not placed yet".
|
||||
4. The run-on check walks the word before each export with its range ending at that export. A word that
|
||||
has no fixed effect for another reason, found first, is not seen to run on.
|
||||
|
||||
**Verified** (`logs/20261120-place/v4-gates.txt`, exit 0):
|
||||
- `make -C v4 test`: the mesh boots at POST 990/990, the placement among them, and `mkf18a` at 95 checks
|
||||
at both widths.
|
||||
- `make -C v4 test-32` passes.
|
||||
- `make -C v4 sanitize` passes, the mesh boot with the placement included.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user