v4: the host placer, and a small train placed on Hera at her HERE (ADR step 3, task 4)

place.c places a train's artifact as ABI.md section 5 has it, the
code split at each export with its entry before it. test_mesh_boot
places tests/train-place, built by mkf18a with an import from the
nucleus: its words run by name, the nucleus's ABS is reached, the
kernel records each export, and six refusals leave Hera unchanged.
mkf18a refuses a word that runs on into an export. Failed first;
gates pass, POST 990/990. Plan section 13.

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-20 12:44:50 +00:00
parent cf2a321807
commit f7769c0e93
16 changed files with 2246 additions and 10 deletions
@@ -346,3 +346,53 @@ and placing them on a node are the ADR's steps 4 and 6 (§3).
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.