v4 ACL: the countdown at call, as v3 -- the call hook may redirect
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:
@@ -164,6 +164,24 @@ int main(void)
|
||||
}
|
||||
CHECK(all, "init.4th pinned the %u words that create or end nodes", (unsigned)(sizeof pinned / sizeof pinned[0]));
|
||||
}
|
||||
{ /* the ACL countdown at call, as v3's inner interpreter (docs/v4.0.0/plans/2026-11-19-acl-at-call.md) */
|
||||
long t1 = -1, t2 = -1;
|
||||
r = line(V4_MESH_HERA, ": F1 65 EMIT ; : G1 F1 ; G1 ' F1 ACL-TTL@ . G1 ' F1 ACL-TTL@ .", &how);
|
||||
if (how == V4_TEXT_COMPLETED) (void)sscanf(r, "A%ld A%ld", &t1, &t2);
|
||||
CHECK(t1 >= 256 && t2 == t1 - 1, "a word called from a definition is checked at the call, and counted down: \"%s\"", r);
|
||||
r = line(V4_MESH_HERA, "0 ' F1 ACL-ALLOW! G1", &how);
|
||||
CHECK(how == V4_TEXT_ERROR && strstr(r, "ACL: denied 'F1'"),
|
||||
"a denied word called from a definition is refused at the call, by its own name: \"%s\"", r);
|
||||
CHECK(strstr(r, "denied 'F1'") && strncmp(r, "A", 1) != 0, " and does not run: \"%s\"", r);
|
||||
r = line(V4_MESH_HERA, ": G2 F1 ;", &how);
|
||||
CHECK(how == V4_TEXT_COMPLETED, "a denied word can be compiled into a definition, as v3: \"%s\" (%d)", r, how);
|
||||
r = line(V4_MESH_HERA, "G2", &how);
|
||||
CHECK(how == V4_TEXT_ERROR && strstr(r, "ACL: denied 'F1'"), " and it is refused when the definition runs: \"%s\"", r);
|
||||
t1 = t2 = -1;
|
||||
r = line(V4_MESH_HERA, ": F3 66 EMIT ; F3 ' F3 ACL-TTL@ . F3 ' F3 ACL-TTL@ .", &how);
|
||||
if (how == V4_TEXT_COMPLETED) (void)sscanf(r, "B%ld B%ld", &t1, &t2);
|
||||
CHECK(t1 >= 256 && t2 == t1 - 1, "a word at the prompt is counted once a use, not twice: \"%s\"", r);
|
||||
}
|
||||
r = line(V4_MESH_HERA, "1900 BLOCK 16 TYPE", &how);
|
||||
CHECK(how == V4_TEXT_COMPLETED && strncmp(r, "( forth79.4th --", 16) == 0, "forth79.4th's lowest block is in RAM block 1900: \"%.20s\" (%d)", r, how);
|
||||
/* starshipos.4th, a system capsule loaded before POST (MACHINE.md 3, step 3; ruled 2026-11-18) */
|
||||
|
||||
Reference in New Issue
Block a user