feat(v4): a hook at call, for whoever runs the node
Plan 2026-10-20 (ENGINE step 4), Task A1, for #189 -- Captain Bob, 2026-11-12: the physics blocks alpha.5; order A, 1, 2, then 7. - exec.h/exec.c: v4_call_hook, es->on_call/on_call_ctx; called at `call` once the return address is pushed, before P moves. NULL: as before. - heat.h/heat.c: the per-call-target table (4096 slots, no capsule word counted), its freeze mask and v4_heat_call_* go (ENGINE.md step 3: "The per-call-target count goes"); the kernel will keep a word's accounts. - tests: test_call_hook_sees_every_call, seen to fail first (no on_call); test_heat's per-call tests go with the table. - the plan records today's rulings (order; HEAT-OP: both, a full array). Suite (logs/20261112-225951/v4-tests): test, test-32, sanitize, 0 failures; hosted-check, the three alike. amd64 boot: POST 538/538, dict_hash 0x8c92508f748f99cf, unchanged -- nothing sets the hook yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+10
-1
@@ -11,7 +11,10 @@
|
||||
*
|
||||
* Section 1.4: "Every retired instruction increments that opcode's heat counter
|
||||
* and advances the anti-clock; every `call` increments the heat counter of its
|
||||
* target. None of this costs an instruction."
|
||||
* target. None of this costs an instruction." A call's target is counted by
|
||||
* whoever runs the node, through the hook below (ENGINE.md step 3; plan
|
||||
* 2026-10-20, Task A1, #189): the kernel keeps a word's accounts. The engine's
|
||||
* own per-call-target table, a stand-in, is gone.
|
||||
*
|
||||
* The node owns P, A, B, the stacks and memory; heat and the anti-clock are
|
||||
* separate physics state (section 7 names them as registers).
|
||||
@@ -37,8 +40,14 @@
|
||||
#include "v4/iword.h"
|
||||
#include "v4/node.h"
|
||||
|
||||
/* Called at `call` once the return address is pushed and before P moves to the
|
||||
* target (so P is still the return address). NULL: no hook. */
|
||||
typedef void (*v4_call_hook)(void *ctx, v4_node *n, v4_cell target);
|
||||
|
||||
typedef struct {
|
||||
v4_uheat_t anticlock;
|
||||
v4_call_hook on_call; /* reset leaves NULL */
|
||||
void *on_call_ctx;
|
||||
|
||||
/* A node blocked at its port in the middle of an instruction word
|
||||
* (node.h) goes on, when it has been served, from the slot after the
|
||||
|
||||
Reference in New Issue
Block a user