feat(v4): Phase 7 -- the tick counted as v3's: tokens taken, and words run from code defined at run time (#189)

Captain Bob, 2026-11-14: "v3" ... "we can always change it late". v3 counts an execution per token its
(C) interpreter takes and per word its definitions run. Measured on 8 lines, counting every call on v4 gave
~700 to v3's one for typed lines (the F18 interpreter's own calls) but 1:1 in compiled code, so no single
HEARTBEAT_CHECK_FREQUENCY could match v3. Now INTERPRET counts its tokens in (TOKENS) -- one F18 store, the
map gains the cell -- and the kernel adds them at each call; a call counts, and gets physics, only from
dictionary space or as INTERPRET's or EXECUTE's dispatch (the image gains their addresses). The knob stays
at v3's 256. test_inference.c out of the per-width tests (its own rule). Tests first: test_mesh_boot.c 90,
99 on, 87 without opcode physics; v4 test all pass. amd64 PASS, 181 s, dict_hash 0x5c53b2e18343a9b6.
Not pushed (held to the end of Phase 7).

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-14 01:22:35 +00:00
parent 28ffed8f57
commit 855632b3c0
14 changed files with 88 additions and 16 deletions
+4
View File
@@ -79,6 +79,10 @@ typedef struct {
/* CONTEXT: the variable that holds the address of the vocabulary names are looked up in first (dict.f18) */
v4_cell context;
/* the tick, as v3's (#189 Phase 7): (TOKENS), which INTERPRET counts tokens in; dictionary space, the code
* defined at run time, from which a call is a word run; and where INTERPRET and EXECUTE make their calls */
v4_cell tokens, dict_lo, dict_hi, runx, exec;
/* the block window: the word address of the slots the kernel copies
* blocks into (v4/blocks.h) */
v4_cell block_window;
+2 -1
View File
@@ -192,7 +192,8 @@ typedef struct {
typedef struct {
uint64_t tick; /* the node's heartbeat cycles (v3's tick_count): by execution, as v3 */
uint32_t check_counter; /* word calls since the last cycle */
uint32_t check_counter; /* executions since the last cycle: v3's, tokens and words run */
v4_cell tokens_seen; /* (TOKENS) when last added in */
uint32_t cycle_every; /* V4_MESH_CHECK_FREQUENCY */
uint64_t decay_slope_q48;
uint8_t l3_decay; /* L8's gate on Loop #3 */