From 5b752693ae348ae90a6c87bbcdba8a177d253c7e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 13:11:47 +0000 Subject: [PATCH] perf(v4): the lookup keeps its key in B; POST sends one line per suite, not three (#189) Captain Bob's "Find the TCG cost first", continued. aarch64 still ran out of its 570 s at 281972ab (logs/20261114-133155, STOPPED); amd64 passed in 253 s (logs/20261114-132732). - (LOOKUP): the count-and-first-character key in register B while the entries are walked, and the xt kept on the stack until an entry passes it -- about 19 opcodes for an entry that cannot be the word, from 28. The answer is the same. - POST: a suite begins with one line, DECIMAL FORTH DEFINITIONS FORGET (POST); its mark is made by the state line of its first case run (a skipped kernel case passes it on). mesh-boot: 15.7 s -> 12.2 s (37.7 s before this work), POST 990 of 990. make -C v4 test: all passed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm --- capsules/v4/sys/dict.f18 | 7 ++++--- .../amd64/qemu-amd64-20261114-132732.log | 3 +++ logs/20261114-133155/aarch64/README.md | 6 ++++++ .../aarch64/qemu-aarch64-20261114-133155.log | 3 +++ v4/system/post.c | 17 ++++++++++++----- 5 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 logs/20261114-132732/amd64/qemu-amd64-20261114-132732.log create mode 100644 logs/20261114-133155/aarch64/README.md create mode 100644 logs/20261114-133155/aarch64/qemu-aarch64-20261114-133155.log diff --git a/capsules/v4/sys/dict.f18 b/capsules/v4/sys/dict.f18 index 74ebd3b6..06c3fcdc 100644 --- a/capsules/v4/sys/dict.f18 +++ b/capsules/v4/sys/dict.f18 @@ -234,11 +234,12 @@ set HDR-NFA here ", (TELL-FORGOTTEN) #id, #, 0 #, HDR-NFA #, HDR-LINK set HDONE: drop 0 (D)+4 a! ! \ not yet on to FORTH (D)+1 a! @ dup 1 + C@ 2* 2* 2* 2* 2* 2* 2* 2* SWAP C@ + (D)+5 a! ! + (D)+5 b! \ B stays on it while the entries are walked CONTEXT a! @ a! @ L: if END - dup (D)+2 a! ! - -2 + a! @ a! @ 65535 and (D)+5 a! @ xor if PRE drop jump OLDER - PRE: drop \ its count and first character are the string's: is it visible, + dup -2 + a! @ a! @ 65535 and @b xor if PRE + drop -1 + a! @ jump L \ not it: the entry before + PRE: drop (D)+2 a! ! \ its count and first character are the string's: is it visible, (D)+2 a! @ -3 + a! @ 2 and if VISIBLE drop jump OLDER VISIBLE: drop \ and is it all the same? (D)+2 a! @ -2 + a! @ 4* (D) a! ! \ its name diff --git a/logs/20261114-132732/amd64/qemu-amd64-20261114-132732.log b/logs/20261114-132732/amd64/qemu-amd64-20261114-132732.log new file mode 100644 index 00000000..3c332546 --- /dev/null +++ b/logs/20261114-132732/amd64/qemu-amd64-20261114-132732.log @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5478464ac95d59007b274c6010c5cc368868776faaa82cd07336db0b7e02e1b +size 9660 diff --git a/logs/20261114-133155/aarch64/README.md b/logs/20261114-133155/aarch64/README.md new file mode 100644 index 00000000..e2f1eefe --- /dev/null +++ b/logs/20261114-133155/aarch64/README.md @@ -0,0 +1,6 @@ +# STOPPED -- timed out (development boot, not the protocol) + +`timeout 570 scripts/nightly.sh accept aarch64` on 281972ab (#189 Phase 7: v3's whole POST, 990 cases, after the +per-suite put-back and the lookup's two-byte test; amd64 on that commit 253 s). The 570 s ran out in POST: the log +ends in the capsules' parity lines. aarch64 took 460-473 s with the 539-case POST (logs/20261113-170343, +logs/20261113-191606). Followed by a faster lookup and fewer POST lines. diff --git a/logs/20261114-133155/aarch64/qemu-aarch64-20261114-133155.log b/logs/20261114-133155/aarch64/qemu-aarch64-20261114-133155.log new file mode 100644 index 00000000..5825520e --- /dev/null +++ b/logs/20261114-133155/aarch64/qemu-aarch64-20261114-133155.log @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4488c47698b364fcf71e8ba341747b74815aa7bc8019ca94fe05a561f6b3ef7 +size 5435 diff --git a/v4/system/post.c b/v4/system/post.c index e87169c0..d0ad2dfb 100644 --- a/v4/system/post.c +++ b/v4/system/post.c @@ -13,11 +13,14 @@ #define SHOWN_STACK 32u /* and how many of the values it left */ static const char state_line[] = "DECIMAL FORTH DEFINITIONS"; +static const char state_mark[] = "DECIMAL FORTH DEFINITIONS CREATE (POST)"; /* the same, and a suite's mark made */ /* Before each of v3's suites the words the cases before it defined go, as v3's run_test_suite puts back LATEST and * HERE (and nothing else: SCR, BASE and the rest stay as the cases left them). A mark, (POST), is made at a suite's * start and forgotten at the next's: FORGET takes the dictionary, the word IDs and the kernel's records of them. A - * case that raised the fence above the mark (FENCE) has its FORGET refused, and the next mark is made above it. */ -static const char *const put_back[] = { "DECIMAL FORTH DEFINITIONS", "FORGET (POST)", "CREATE (POST)" }; + * case that raised the fence above the mark (FENCE) has its FORGET refused, and the next mark is made above it. + * The forgetting is a line of its own; the mark is made by the state line of the suite's first case run (a case of + * the kernel's words, not run on the hosted product, passes it on): the fewest lines, for a boot's time. */ +static const char put_back[] = "DECIMAL FORTH DEFINITIONS FORGET (POST)"; static unsigned length(const char *s) { @@ -48,6 +51,7 @@ int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count static v4_cell left[V4_DATA_DEPTH]; /* what it left on the stack, the top first: all of it, to compare (#189: v3's cases leave 101); SHOWN_STACK of it shown */ unsigned i, k; + int mark = 0; /* a suite has begun and its mark is not yet made */ tally->tests = 0; tally->pass = 0; tally->fail = 0; for (i = 0; i < count; i++) { @@ -58,8 +62,9 @@ int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count /* a suite begins: what the cases before it defined goes, as v3 does after each suite */ if (c->expect & V4_POST_SUITE) { - for (k = i ? 0u : 2u, how = 0; how >= 0 && k < 3u; k++) /* the first suite: only the mark */ - how = h->line(h->self, put_back[k], length(put_back[k]), out, V4_POST_OUT, &len); + how = 0; + if (i > 0) how = h->line(h->self, put_back, (unsigned)sizeof put_back - 1u, out, V4_POST_OUT, &len); + mark = 1; if (how < 0) { say(h, "POST: the node did not come back from putting the dictionary back before "); say(h, c->name); say(h, "; "); say_number(h, (long long)(count - i)); say(h, " not run\n"); @@ -71,7 +76,9 @@ int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count /* every case starts from the same state */ v4_dstack_reset(&h->n->ds); - how = h->line(h->self, state_line, (unsigned)sizeof state_line - 1u, out, V4_POST_OUT, &len); + if (mark) how = h->line(h->self, state_mark, (unsigned)sizeof state_mark - 1u, out, V4_POST_OUT, &len); + else how = h->line(h->self, state_line, (unsigned)sizeof state_line - 1u, out, V4_POST_OUT, &len); + mark = 0; if (how < 0) lost = 1; if (how != V4_TEXT_COMPLETED) { /* what the node said of it is what is shown */ came_back = 0; no_state = 1;