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
+5 -3
View File
@@ -100,8 +100,11 @@ typedef struct {
#define V4_MESH_WINDOW 4096u /* v3's ROLLING_WINDOW_SIZE */
#define V4_MESH_WINDOW_WARM 1024u /* executions before the window is warm, as v3 */
#define V4_MESH_ADAPTIVE_CHECK 512u /* v3's ADAPTIVE_CHECK_FREQUENCY: executions between diversity checks */
#define V4_MESH_CHECK_FREQUENCY 256u /* v3's HEARTBEAT_CHECK_FREQUENCY: word calls a heartbeat cycle */
typedef struct {
uint64_t tick;
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 cycle_every; /* V4_MESH_CHECK_FREQUENCY */
uint64_t decay_slope_q48;
uint8_t l3_decay; /* L8's gate on Loop #3 */
uint8_t l2_window; /* L8's gate on Loop #2 */
@@ -156,7 +159,6 @@ struct v4_mesh {
v4_mesh_account *accounts;
unsigned char *is_word;
v4_mesh_physics *physics; /* `capacity` of them: each node's (#189, Phase 7) */
uint64_t (*ticks)(void); /* the heartbeat's tick count, read at each call (0: v4_mesh_set_tick's) */
/* memory for a word's transition counters, zeroed, and given back (pipelining; may be 0: none recorded) */
void *(*alloc)(void *self, unsigned long bytes);
void (*release)(void *self, void *p);
@@ -199,7 +201,7 @@ int v4_mesh_busy(const v4_mesh *ms);
/* A word's record on the node in `place`, by its xt: 0 if that is not a word's xt. */
const v4_mesh_account *v4_mesh_account_at(const v4_mesh *ms, unsigned place, v4_cell xt);
/* The heartbeat's tick, for every node (v3's vm->heartbeat.tick_count): what decay is measured by. */
/* Every node's tick set to `tick` (for tests: a node's tick is its own count of heartbeat cycles). */
void v4_mesh_set_tick(v4_mesh *ms, uint64_t tick);
/* A word's state flags (V4_MESH_STATE_*), or 0 if xt is not a word's. */