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:
@@ -216,6 +216,7 @@ enum { V4_ROM_ERRORS(ROM_ERR_ENUM_) ROM_ERR_END_ };
|
||||
#define BOOT_CELLS (BVARS + 14) /* (BOOT): DP and LATEST as the loader left them, 2 cells */
|
||||
#define NEXT_ID (BVARS + 10) /* (NEXT-ID): the word ID the next entry is given (#189, Phase 2) */
|
||||
#define BOOT_ID (BVARS + 11) /* (BOOT-ID): (NEXT-ID) as the loader left it, which COLD comes back to */
|
||||
#define TOKENS (BVARS + 12) /* (TOKENS): how many tokens INTERPRET has taken -- the tick's count, as v3's (#189) */
|
||||
#define BUF0_W (BVARS - (v4_cell)(V4_BLOCK_SLOTS * V4_BLOCK_CELLS)) /* the block window: the kernel's slots, 256 cells each (v4/blocks.h) */
|
||||
/* The ports and the addresses after them, through V4_PORT_HAVE (node.h, MESH.md 7d.3), are not memory and must be where
|
||||
* no variable is: after the output buffer, which ends at BUF0_W - 144, and before OUT_HDR, the first variable above it.
|
||||
@@ -291,6 +292,7 @@ static unsigned host_branch_slots(void)
|
||||
X("(HOT)", HOTVARS) \
|
||||
X("(BOOT)", BOOT_CELLS) \
|
||||
X("(NEXT-ID)", NEXT_ID) \
|
||||
X("(TOKENS)", TOKENS) \
|
||||
X("(BOOT-ID)", BOOT_ID) \
|
||||
X("(LOG-LEVEL)", LOG_LEVEL) \
|
||||
X("(ACL-HOOK)", ACL_HOOK) \
|
||||
|
||||
Reference in New Issue
Block a user