feat(v4): Phase 7 Task 3, first step -- each node's tick by execution, as v3 (#189)

Captain Bob, 2026-11-13: "By execution, as v3". v3's kernel runs a VM's heartbeat cycle every 256 word
executions (HEARTBEAT_CHECK_FREQUENCY, vm_core.c:912 and :1210), and its tick_count is the count of cycles.
Task 2a had used the kernel's timer heartbeat as the decay clock: corrected. Each node counts its word
calls; every 256th runs its heartbeat cycle at the call; the cycle's loops follow. The kernel no longer
gives the mesh its timer. Test first: test_mesh_boot.c, 59 checks (67 with pipelining and the cache on).
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-13 22:17:50 +00:00
parent e125c2b590
commit 5c79bddbbb
5 changed files with 41 additions and 7 deletions
+14
View File
@@ -225,8 +225,14 @@ int main(void)
v4_mesh_physics *p = &ms.physics[0];
const v4_mesh_account *a;
uint64_t total0;
uint32_t every = p->cycle_every;
r = line(V4_MESH_HERA, ": P7 DUP * ; ' P7 .", &how);
a = v4_mesh_account_at(&ms, 0, (v4_cell)strtol(r, 0, 10));
/* the tick, by execution (Captain Bob, 2026-11-13: "By execution, as v3"): every 256 word calls a
* node's heartbeat cycle runs, and its tick is the count of them -- held still here, so decay's
* arithmetic is seen exactly, and seen moving below */
CHECK(every == 256u, "a node's heartbeat cycle comes every 256 word calls, as v3's HEARTBEAT_CHECK_FREQUENCY");
p->cycle_every = 0xFFFFFFFFu;
v4_mesh_set_tick(&ms, 100);
total0 = p->total_executions;
r = line(V4_MESH_HERA, "2 P7 3 P7 4 P7 + + .", &how);
@@ -256,6 +262,14 @@ int main(void)
r = line(V4_MESH_HERA, "2 P7 .", &how);
CHECK(a && a->heat == 1, "and with it on, 300 ticks take all six, then one: %lu", a ? (unsigned long)a->heat : 0ul);
v4_mesh_set_tick(&ms, 0);
p->cycle_every = every;
{
uint64_t t0 = p->tick;
r = line(V4_MESH_HERA, ": LP7 300 0 DO 2 P7 DROP LOOP ; LP7", &how);
CHECK(p->tick >= t0 + 2,
"300 calls of P7, and the many the line's compiling makes: the tick moves, a cycle per 256 (%lu)",
(unsigned long)(p->tick - t0));
}
r = line(V4_MESH_HERA, "FORGET P7", &how);
}
r = line(V4_MESH_HERA, "3 SQ .", &how);