v4 ACL: the countdown at call, as v3 -- the call hook may redirect
Build / Image PC (push) Successful in 6m13s
Build / Image MILKV (push) Successful in 6m40s
Build / v4 tests (32- and 64-bit cells) (push) Successful in 14m18s
Build / Image RASPI (push) Successful in 3m11s

Captain Bob ruled "As v3: add at call", "Engine: call redirects" and
"Build it".
- The engine's call hook returns where P goes.
- The kernel checks every call from code defined at run time. A TTL is
  counted down at the call. At a TTL of 0, or a denied word, the call is
  sent to (ACL-CALL), with the target on the data stack, which rechecks
  or refuses it by the word's own name, then goes on to it.
- A word being compiled is no longer checked, as in v3.

Two things were added while building, both from v3:
- (ACL-BUSY) turns the check off while the policy rechecks. Without it
  the recheck recursed.
- (ACL-CALL) does its own refusal and leaves WORD's buffer alone. A first
  version broke POST's CONVERT.digits.

Test first: test_mesh_boot's five new checks failed before; now 120 pass
and POST is 990/990. test_exec tests the redirect. test_host_quit's two
v4-only expectations now follow v3: a denied word compiles.

All 52 tests, test-32 and ASan/UBSan pass. An amd64 session passes 18/18.
Five alternating host boots: +1.4% median, inside the noise.
DECOMPOSITION.md 5.20 is updated, and the FPGA's call opcode is recorded
as owing the same redirect.

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-19 14:10:16 +00:00
parent 666cf39b8b
commit 7af88cc704
30 changed files with 1383 additions and 35 deletions
+5 -2
View File
@@ -41,8 +41,11 @@
#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);
* target (so P is still the return address). It returns where P goes: the
* target, or another address the call is sent to instead, which returns to the
* caller as the target would (the ACL's check at call, docs/v4.0.0/plans/
* 2026-11-19-acl-at-call.md). NULL: no hook, and P goes to the target. */
typedef v4_cell (*v4_call_hook)(void *ctx, v4_node *n, v4_cell target);
/* Called when an instruction retires, after HEAT-OP counts it, with its opcode (0..31): compudynamics on the
* opcodes (#189 Phase 7, ruling 7). NULL: no hook. */
+4
View File
@@ -83,6 +83,10 @@ typedef struct {
* defined at run time, from which a call is a word run; and where INTERPRET and EXECUTE make their calls */
v4_cell tokens, dict_lo, dict_hi, runx, exec;
/* the ACL's check at call (docs/v4.0.0/plans/2026-11-19-acl-at-call.md): the cell that holds (ACL-CALL)'s address,
* and the cell that is 1 while the policy rechecks a word */
v4_cell acl_call, acl_busy;
/* the block window: the word address of the slots the kernel copies
* blocks into (v4/blocks.h) */
v4_cell block_window;