feat(v4): Phase 7 Task 1 -- v3's physics fields on the word records, and each node's physics state (#189)

v4_mesh_account gains v3's DictPhysics: heat (execution_heat), last_decay_tick, temperature_q8, and the
kernel's own state flags (pinned, frozen); v4_mesh_physics gives each node v3's VM fields -- its tick,
the decay slope (v3's initial 21845, Q48.16), L8's gate on Loop #3. v4_mesh_state_flags derives a word's
flags as v3 does, immediate and hidden read from the node's header when asked. Test first:
test_mesh_boot.c, 48 checks. The kernel gives each of its 16 places its physics. Not pushed (held,
Captain Bob 2026-11-13: "Hold it, go ahead with Task 1").

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 20:00:28 +00:00
parent 41f8c1ec28
commit 922451cf52
5 changed files with 69 additions and 0 deletions
+19
View File
@@ -158,6 +158,7 @@ static void word_made(unsigned place, const v4_node *n, v4_cell xt)
if (id >= 0 && id < (v4_cell)V4_MESH_WORD_IDS) {
v4_mesh_account *a = &accounts_of(place)[id];
a->calls = 0; a->since = 0; a->xt = xt;
a->heat = 0; a->last_decay_tick = 0; a->temperature_q8 = 0; a->state_flags = 0; /* as v3's physics_metadata_init */
}
}
@@ -175,6 +176,7 @@ static void words_gone(unsigned place, const v4_node *n, v4_cell w)
if (id >= 0 && id < (v4_cell)V4_MESH_WORD_IDS && accounts_of(place)[id].xt == a) {
v4_mesh_account *r = &accounts_of(place)[id];
r->calls = 0; r->since = 0; r->xt = 0;
r->heat = 0; r->last_decay_tick = 0; r->temperature_q8 = 0; r->state_flags = 0;
if (the->forgot) the->forgot(the->self, place, id);
}
}
@@ -225,10 +227,27 @@ static void words_attach(unsigned place, v4_fabric_node *x)
x->n.mem[im->word_defined] = told;
x->n.mem[im->word_forgotten] = gone;
}
if (the->physics) { /* the node's physics, as v3's VM starts */
the->physics[place].tick = 0;
the->physics[place].decay_slope_q48 = V4_MESH_INITIAL_DECAY_SLOPE_Q48;
the->physics[place].l3_decay = 1;
}
x->es.on_call = on_call;
x->es.on_call_ctx = &the->kernel[place];
}
unsigned v4_mesh_state_flags(const v4_mesh *ms, unsigned place, v4_cell xt)
{
const v4_mesh_account *a = v4_mesh_account_at(ms, place, xt);
v4_fabric_node *x = v4_fabric_node_at(&ms->f, place);
unsigned f;
if (!a || !x) return 0;
f = a->state_flags & (V4_MESH_STATE_PINNED | V4_MESH_STATE_FROZEN);
if (x->n.mem[xt - 3] & 1) f |= V4_MESH_STATE_IMMEDIATE; /* dict.f18: 1 immediate, 2 hidden */
if (x->n.mem[xt - 3] & 2) f |= V4_MESH_STATE_HIDDEN;
return f;
}
const v4_mesh_account *v4_mesh_account_at(const v4_mesh *ms, unsigned place, v4_cell xt)
{
v4_fabric_node *x = v4_fabric_node_at(&ms->f, place);