Ruled (Captain Bob, 2026-11-14): "Find the TCG cost first". v3's whole POST took the amd64
accept from about 3 m 15 s to 8 m 45 s, and aarch64 past its 570 s (logs/20261114-091651,
STOPPED, committed). Profiled on the host (gprof, mesh-boot): 87% of the time in POST's
lines, about 280,000 opcodes a line -- the interpreter's dictionary lookup.
- POST puts the dictionary back before each of v3's suites, as v3's run_test_suite does
("to remove test-created words"): a mark, (POST), forgotten and made again
(V4_POST_SUITE). Only the dictionary: SCR, BASE and the rest stay as the cases left them.
- (LOOKUP) tries each entry by its count and first character first -- one fetch of the
name's first cell, masked -- and only then its hidden flag and the whole name. The answer
is the same; an entry that cannot be it costs a few opcodes, not some forty.
mesh-boot: 37.7 s -> 15.7 s, POST 990 of 990. make -C v4 test: all v4 tests passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
170 lines
13 KiB
Markdown
170 lines
13 KiB
Markdown
# v3's whole POST on v4 -- the inventory
|
|
|
|
Started 2026-11-13, Task 0 of `plans/2026-11-13-engine-step4-phase7-the-loops-and-parity.md` (#189).
|
|
Captain Bob, 2026-11-13: Phase 7 is accepted on **"v3's whole POST"**. This counts every case of v3's
|
|
POST against v4 as it is on e8e7ec8b (377 live words), with `v4/tools/mkpost.py`'s own reader of
|
|
`v3/src/test_runner/modules/`. It proposes; it decides nothing.
|
|
|
|
## 1. The 17 modules `mkpost.py` reads today
|
|
|
|
v4's POST keeps only their cases for the FORTH-79 Required Word Set (550 read, 539 after what
|
|
`mkpost.py` leaves out: the keyboard, words that forget or damage the system, lines too long).
|
|
|
|
| Module | Cases | Required (on v4's POST) | Other words v4 has | Words v4 lacks |
|
|
|---|---|---|---|---|
|
|
| stack_words_test.c | 55 | 50 | 5 | 0 |
|
|
| return_stack_words_test.c | 11 | 11 | 0 | 0 |
|
|
| memory_words_test.c | 53 | 38 | 15 | 0 |
|
|
| arithmetic_words_test.c | 104 | 92 | 12 | 0 |
|
|
| logical_words_test.c | 103 | 64 | 39 | 0 |
|
|
| mixed_arithmetic_words_test.c | 40 | 18 | 22 | 0 |
|
|
| double_words_test.c | 125 | 21 | 104 | 0 |
|
|
| format_words_test.c | 31 | 25 | 6 | 0 |
|
|
| string_words_test.c | 49 | 15 | 34 | 0 |
|
|
| io_words_test.c | 73 | 61 | 3 | 9 (`BASE_OUTPUT`, `FORMAT_COMBO`: groups, not words) |
|
|
| block_words_test.c | 51 | 30 | 21 | 0 |
|
|
| dictionary_words_test.c | 49 | 22 | 15 | 12 (`SP!`, `SP@`; `COMPILATION`, `STACK_MGMT`: groups) |
|
|
| dictionary_manipulation_words_test.c | 29 | 16 | 13 | 0 |
|
|
| vocabulary_words_test.c | 22 | 19 | 3 | 0 |
|
|
| system_words_test.c | 7 | 4 | 3 | 0 |
|
|
| defining_words_tests.c | 32 | 22 | 10 | 0 |
|
|
| control_words_test.c | 54 | 42 | 12 | 0 |
|
|
| **Total** | **888** | **550** | **317** | **21** |
|
|
|
|
The 317 test words v4 already has; they are left out only because `mkpost.py` keeps the Required set.
|
|
|
|
## 2. The nine modules `mkpost.py` does not read
|
|
|
|
| Module | Cases | Words v4 lacks | Kind |
|
|
|---|---|---|---|
|
|
| q48_words_test.c | 28 | none | FORTH lines; every word is on v4 |
|
|
| starforth_words_test.c | 29 | `ENTROPY!` `ENTROPY@` `RESET-ENTROPY` `TOP-WORDS` `WORD-ENTROPY` `(-` | FORTH lines; the entropy and top-words words read the physics |
|
|
| physics_freeze_words_test.c | 7 | `FREEZE-WORD` `UNFREEZE-WORD` `FROZEN?` `HEAT@` `HEAT!` `DECAY-RATE@` | FORTH lines; the loops' words |
|
|
| inference_words_test.c | 9 | `INFER-RUN` `INFER-DECAY-SLOPE` `INFER-DECAY@` `INFER-EARLY-EXIT@` `INFER-FIT@` `INFER-VARIANCE@` `INFER-WINDOW-WIDTH` `INFER-WINDOW@` `Q.VARIANCE` | FORTH lines; the inference engine's words |
|
|
| stress_tests.c | 45 | none (14 group names) | FORTH lines |
|
|
| integration_tests.c | 8 | none (3 group names) | FORTH lines |
|
|
| mama_forth_words_test.c | 20 | `CAPSULE-BIRTH` `CAPSULE-RUN` `CAPSULE-TEST` `CAPSULE-COUNT` `CAPSULE@` `CAPSULE-FLAGS@` `CAPSULE-HASH@` `CAPSULE-LEN@` `MAMA-VM-ID` `VM-COUNT` | FORTH lines about v3's VMs and capsule directory |
|
|
| acl_words_test.c | 11 | -- | **C**, against v3's VM's fields (`vm->...`), not FORTH lines |
|
|
| break_me_tests.c | 1 | -- | **C**, one routine against v3's VM |
|
|
|
|
## 3. For ruling
|
|
|
|
1. **Mama** (20 cases): the words are v3's: a VM ID, a VM count, v3's capsule directory. v4 has nodes,
|
|
births (`BIRTH`, `NODE-ME`) and its own capsules. Written as v4 words with v3's names and meaning,
|
|
mapped to v4's equivalents, or out of parity?
|
|
2. **The C modules** (ACL, break_me): they read v3's VM's fields directly. Rewritten as tests of the
|
|
same behaviour against v4 (FORTH lines where they can be, host tests in C where they cannot), or
|
|
out?
|
|
3. **The group names** (`STACK_BOUNDARY`, `COMPILATION`, ...): v3 files cases under a group, not a word.
|
|
They are cases like any other, run as they are; nothing to rule unless a case fails.
|
|
|
|
**Ruled (Captain Bob, 2026-11-13):**
|
|
1. **Mama:** v4 words with v3's names and meaning, mapped to v4's equivalents -- "but do not compose
|
|
words in C99, use F18 and StarForth". The words are written in the system's F18 or in StarForth;
|
|
where only the kernel can answer (the registry, the capsules it holds), the word asks it by a
|
|
request on port 0, as `KERNEL-WORD` words do. The 20 cases run as they are.
|
|
2. **The C modules:** rewritten for v4, the same behaviour shown case by case -- as FORTH lines in POST
|
|
where they can be, as host tests in C where they need internals.
|
|
|
|
## 4. What parity needs, in count
|
|
|
|
About 1,050 cases: 888 in section 1, 146 FORTH-line cases in section 2's modules, and the C modules' 12 tests -- 1,046. v4 has 539 today.
|
|
The loops' own words (physics freeze, inference, entropy, top words) are 22 cases; the ACL and Mama
|
|
modules wait on section 3.
|
|
|
|
## 5. Measured (2026-11-14, Task 8)
|
|
|
|
`v4/tools/mkpost.py --all --out FILE` writes every case of v3's whole POST -- v3's 22 POST modules in
|
|
`test_runner.c`'s order, Q48, the stress and integration tests -- as a table, v3 the reference, leaving
|
|
`system/post_cases.c` as it is. Run on Hera in the kernel's fabric (the mesh boot, with the kernel's
|
|
capsules) on the tree after Task 4: **1020 cases, 849 pass, 171 fail.**
|
|
|
|
Failures by word: `C,` 8, `TOP-WORDS` 7, `CASE` 5, `M/MOD` 5, `U/MOD` 5, `(-` 4, `BASE_OUTPUT` 4, `COMPARE` 4, `LATEST` 4, `M+` 4, `SEARCH` 4, `WORD` 4, `-!` 3, `2!` 3, `COMPLETE_PROGRAMS` 3, `FENCE` 3, `MEMORY_STRESS` 3, `ORDER` 3, `SCAN` 3, `SKIP` 3, `SP@` 3, `STACK_DEPTH` 3, `WORD-ENTROPY` 3, `2,` 2, `2>R` 2, `2R>` 2, `2R@` 2, `>BODY` 2, `AGAIN` 2, `BEGIN` 2, `CMOVE>` 2, `DEEP_NESTING` 2, `EXIT` 2, `FROZEN?` 2, `MIXED_COMPLEX` 2, `NUMERIC_BOUNDARY` 2, `RETURN_STACK` 2, `S"` 2, `STACK_BOUNDARY` 2, `STACK_MGMT` 2, `STRING_EDGE` 2, `THRU` 2, `WHILE` 2, `+LOOP` 1, `."` 1, `?` 1, `ALGORITHMS` 1, `BL` 1, `COMPILATION` 1, `COMPILE` 1, `CONTROL_EDGE` 1, `CONVERT` 1, `DABS` 1, `DECAY-RATE@` 1, `DMIN` 1, `ENTROPY@` 1, `ERROR_RECOVERY` 1, `EXECUTE` 1, `FLUSH` 1, `FREEZE-WORD` 1, `HEAT!` 1, `HEAT@` 1, `HIDDEN` 1, `INFER-DECAY-SLOPE` 1, `INFER-EARLY-EXIT@` 1, `INFER-VARIANCE@` 1, `IS` 1, `LITERAL` 1, `Q./` 1, `Q.0` 1, `Q.1` 1, `Q.SCALE` 1, `Q.VARIANCE` 1, `REPEAT` 1, `RESET-ENTROPY` 1, `SMUDGE` 1, `SP!` 1, `SPAN` 1, `STATE` 1, `UNFREEZE-WORD` 1, `UNTIL` 1, `[']` 1, `[COMPILE]` 1.
|
|
|
|
What they are:
|
|
1. **Address units.** v3's cases do byte-address arithmetic in 8-byte cells (`C,`, `2!`, `SEARCH`,
|
|
`COMPARE`, `CMOVE>`, `-!` ...); v4's address unit is a cell (D-1). The case wants v4's units, as
|
|
`post79_rules.ADDRESS` already gives 20.
|
|
2. **What v4 lacks or does otherwise.** `SP@` `SP!`; `CASE` (its cases define `TC` with it); `U/MOD` and
|
|
`M/MOD` in v3's shape; `SKIP` `SCAN` `SEARCH` `COMPARE`; `ORDER` `THRU` `FLUSH`; the vocabulary and
|
|
compile-time edges. To be built, or the difference shown to be the standard's.
|
|
3. **v3's output naming v3's own words.** `TOP-WORDS` expects v3's hottest -- `EXIT`, `DROP`, `LIT`, `."` --
|
|
and `WORD-ENTROPY` v3's word count: v4's system is not v3's.
|
|
4. **v3 not doing what its own table says** (29 cases; e.g. `2!.basic`): the expectation recorded is v3's
|
|
error, and a v4 that does what the table says fails it.
|
|
5. The rest -- formatting, the stress and integration groups -- case by case.
|
|
|
|
**Ruled (Captain Bob, 2026-11-14): "v3's table, not v3's bugs".** Where v3 does not do what its own table
|
|
says (kind 4: 29 cases), v4 is held to the table -- what v3 meant -- and each such case is listed. Where a
|
|
case's output names v3's internals (kind 3), v4 is held to the same form with its own words: the case's
|
|
shape, v4's values; listed too. Everything else: v3's recorded behaviour, exactly.
|
|
|
|
**Ruled (Captain Bob, 2026-11-14): "The standard first".** Read with their descriptions, v3's cases are not a
|
|
reliable authority: `16 BASE ! 255 .` -- v3 prints 597, its description says FF, FORTH (and v4) print 255; `M+`
|
|
-- v3 300 0, its description 200 100, FORTH and v4 100 200. So, for each case: FORTH-79 where it defines the
|
|
word (as `post79_rules.py` already does for the Required set); FORTH-83 for words 79 lacks (`M+`, `2>R` ...);
|
|
v3's behaviour -- or its table, where v3 contradicts it -- only for v3's own extensions no standard defines
|
|
(`COMPARE`'s form, `ENTROPY@`, `TOP-WORDS` ...). Every case rewritten is listed with its reason.
|
|
|
|
**Ruled further (Captain Bob, 2026-11-14), with the texts in `docs/reference/standards/`:**
|
|
- **The order of authority:** FORTH-79, then FORTH-83, then ANS Forth 1994 ("Yes: 79, then 83, then ANS, then
|
|
v3"), then v3 -- held to its table where it contradicts itself -- only for what no standard defines
|
|
(`ENTROPY@`, `TOP-WORDS`, Mama's words ...).
|
|
- **A double in memory: FORTH-83's layout** ("Yes, FORTH-83's layout"). FORTH-83 (`FORTH83.TXT`, under
|
|
"number"): "Double numbers are represented in memory by two consecutive 16-bit numbers. The address of the
|
|
least significant 16 bits is two greater than the address of the most significant 16 bits." FORTH-79 says
|
|
only "as for a double number" (`2!`). v4's `2!` `2@` `2,` stored the low cell first, "as v3": changed to the
|
|
high cell at the lower address.
|
|
|
|
**Ruled (Captain Bob, 2026-11-14), on four questions from the whole table at 969 of 1018:**
|
|
- **Capacity: "Enlarge v4 to fit".** Four stress cases push 100 to 900 values (v4's prompt node: 32); 21
|
|
cases late in the run meet "Dictionary full" (1018 cases defining words in one dictionary; Hera's run-time
|
|
space about 5.5K cells). The standards ask less (FORTH-79 6.2: a 64-byte data stack, 2000 bytes of
|
|
dictionary; ANS: 32 cells), but v4 is grown until v3's cases fit.
|
|
- **`Q./` by zero: "v3's table: q = 0".** No standard defines the Q48 words; v3's table says division by
|
|
zero yields 0. v4's error 11 ("Division by zero (Q./)") goes.
|
|
- **`SP@` `SP!`: D-2 stands; `FENCE`: v3's** ("D-2 for SP@; v3 for FENCE"). The six `SP@`/`SP!` cases are
|
|
dropped: no stack pointer is visible to code (DECOMPOSITION.md D-2). `FENCE` becomes v3's word -- it
|
|
protects what is defined so far from FORGET -- and the variable FORGET and COLD read is `(FENCE)`.
|
|
- **SPAN: "Fix it in Phase 7".** v4's interpreter took the line's length from SPAN, so an `EXPECT` in a
|
|
line cut the rest of the line off, and `0 EXPECT` could not leave SPAN 0 (FORTH-83: SPAN is the count the
|
|
last EXPECT stored). The line's length gets its own variable.
|
|
|
|
Settled under the rulings above, without a question:
|
|
- `IS` and `DEFER@` refuse a word `DEFER` did not make, as v3 ("was not created by DEFER"): error 22, "Not
|
|
deferred". v4's IS stored into any word -- `42 IS DUP` broke `DUP` for every case after it.
|
|
- `SMUDGE` and `HIDDEN` at the prompt are errors, as v3's table (no standard defines them): v4 marks them
|
|
compile-only. v4's hid the newest word.
|
|
- `DABS` and `DMIN` given too few values: ANS (8.6.1.1160, 8.6.1.1220) makes stack underflow an ambiguous
|
|
condition, so there is no error to expect: dropped.
|
|
- `CMOVE>.bounds` and `THRU.negative_end` dropped (no standard asks for the error); the cases that write
|
|
through `HERE` as a byte address -- `CMOVE>`, `BLANK`, `ERASE`, `FILL` -- in v4's units (they wrote into
|
|
the system's code).
|
|
|
|
## 6. Result (2026-11-14): v3's whole POST is v4's POST
|
|
|
|
**990 cases, all passed on Hera** (`PARITY:V4_POST tests=990 pass=990 fail=0`; mesh-boot), the hosted product
|
|
945 of them (all passed): the 45 cases of the words `capsules/v4/physics.4th` defines ask the kernel, and a node
|
|
with no kernel has none of them (`V4_POST_KERNEL`, `v4_post_host.kernel`). The table is `mkpost.py --all`
|
|
(`make -C v4 post79`); every case not taken as v3 ran it is listed, with its reason, in `POST.md`; the floor
|
|
(`v4/system/POST_FLOOR`) is 990.
|
|
|
|
- **990, not 1010:** v3's Mama module marks its cases `MAMA_IMPLEMENTED`, which is 0 -- v3's own POST skips
|
|
all 20 ("Mama FORTH words ... are kernel runtime objects ... Mark all tests skipped"). `mkpost.py` took any
|
|
flag but a literal `0` as implemented; it now reads a module's `#define`s. v4's Mama words (ruled: v4 words
|
|
with v3's names, in F18 and StarForth) are therefore not part of this acceptance: v3's POST has no case of them.
|
|
- **Enlarged, as ruled:** a node is 32768 words (was 16384) and its data stack 1024 deep (was 32), host and
|
|
kernel alike (`v4/Makefile` HOST_WORDS/HOST_DATA_RING, `kernel/Makefile` V4_DEFS); the dictionary's end
|
|
moves with them (`host_map.h`, DICT_END_W = SEND_TEXT - 53). The return stack stays 32.
|
|
- **POST's runner:** it compares every value a case leaves, not the top 32 (v3's cases leave 101); and a
|
|
new kind, `V4_POST_HEAD`, compares how a printout begins -- the form of `TOP-WORDS` and `WORD-ENTROPY`,
|
|
whose values are the run's own.
|
|
- **Cases written as meant** (v3's table says they run, but as written no FORTH runs them):
|
|
`DATA_STRUCTURES.stack_min_max` (VARIABLE run inside a definition took '42' for its name, and hid the number
|
|
from every case after it) and `COMPLETE_PROGRAMS.array_sum` (`: ARRAY 5 CELLS ALLOT ;` names nothing).
|
|
- **mkpost cuts no line between a word and the name it takes** (`: T20` cut after the `:` was "Name missing").
|
|
- **The boot's time (2026-11-14):** at 990 cases the amd64 accept took 8 m 45 s (about 3 m 15 s at 539), and
|
|
aarch64 ran out of its 570 s in POST (`logs/20261114-091651/aarch64`, STOPPED). The node's doubling is not the
|
|
cost (host mesh-boot 36 s at 16384 words, 37.7 s at 32768). **Ruled (Captain Bob): "Find the TCG cost
|
|
first"** -- profile POST under emulation and bring 990 cases under 570 s on all three, before the push.
|