feat(v4): a believed GONE is handed to the word in (GONE-HOOK) (MESH.md 9a)
COLD takes out a hook it forgets. The system changed, so dict_hash did: hosted, all three ISAs, word_count=318 dict_hash=0x1b5c633fd6bdd143. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d154342314
commit
450dea9c24
@@ -83,6 +83,7 @@ constant (MSG) 14664
|
||||
constant (OUT) 14312
|
||||
constant (WORD-DEFINED) 14701
|
||||
constant (WORD-FORGOTTEN) 14700
|
||||
constant (GONE-HOOK) 14691
|
||||
constant BLOCK# -1
|
||||
constant BUFFER# -2
|
||||
constant UPDATE# -3
|
||||
|
||||
@@ -83,6 +83,7 @@ constant (MSG) 14664
|
||||
constant (OUT) 14312
|
||||
constant (WORD-DEFINED) 14701
|
||||
constant (WORD-FORGOTTEN) 14700
|
||||
constant (GONE-HOOK) 14691
|
||||
constant BLOCK# -1
|
||||
constant BUFFER# -2
|
||||
constant UPDATE# -3
|
||||
|
||||
@@ -80,18 +80,29 @@ macro R-CLEAR RSTACK-DEPTH b! a !b endmacro
|
||||
OK: drop 1 jump (FINISH)
|
||||
GO: drop 0 jump (FINISH)
|
||||
|
||||
\ ( -- ) a GONE has been believed: the word whose xt is in (GONE-HOOK), if
|
||||
\ there is one, is given the number of the node that is gone, in (ONE), so
|
||||
\ that the GONE goes on down the birth graph (MESH.md 9a.2, ruling 7;
|
||||
\ capsules/v4/centre.4th, GONE-DOWN). 0 there, as at switch-on: nothing.
|
||||
\ As (DEFINED) does (dict.f18): the xt goes on the return stack and ;
|
||||
\ goes there, so the word returns to whoever called this.
|
||||
: (DOWN)
|
||||
(GONE-HOOK) b! @b if NONE (ONE) a! @ SWAP push ;
|
||||
NONE: drop ;
|
||||
|
||||
\ ( -- flag ) A GONE has been taken: its seven words are in (IN), the
|
||||
\ node it is about in (ONE), and (S-WIRE) is the wire it came by. It is
|
||||
\ believed only if it came by the port that leads to this node's centre
|
||||
\ and says it is from the centre (MESH.md 7b.4): the way to the node is
|
||||
\ then forgotten, and the flag is -1. Otherwise nothing is done, and 0.
|
||||
\ (As first built only what it said it was from was looked at, and one
|
||||
\ that came by another port was believed.)
|
||||
\ that came by another port was believed.) Believed, it is handed on:
|
||||
\ (DOWN).
|
||||
: (GONE?)
|
||||
(CENTRE) if NOT (IN)+1 a! @ xor if FROM drop 0 ;
|
||||
NOT: ;
|
||||
FROM: drop (ROUTE-DEFAULT) a! @ (PORT) - (S-WIRE) a! @ xor if YES drop 0 ;
|
||||
YES: drop (ONE) a! @ NO-ROUTE -1 ;
|
||||
YES: drop (ONE) a! @ NO-ROUTE (DOWN) -1 ;
|
||||
|
||||
\ ( -- ) WAITING (MESH.md 7d.4). A node with nothing to do passes on
|
||||
\ what has come for other nodes, (SERVE), and then goes through what has
|
||||
@@ -419,6 +430,7 @@ set HDR-NFA here ", (LOST) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here :
|
||||
set HDR-NFA here ", (REFUSED) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (REFUSED)' (REFUSED) ;
|
||||
set HDR-NFA here ", (WORD-DEFINED) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (WORD-DEFINED)' (WORD-DEFINED) ;
|
||||
set HDR-NFA here ", (WORD-FORGOTTEN) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (WORD-FORGOTTEN)' (WORD-FORGOTTEN) ;
|
||||
set HDR-NFA here ", (GONE-HOOK) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (GONE-HOOK)' (GONE-HOOK) ;
|
||||
|
||||
set HDR-NFA here ", QUIT #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: QUIT R-CLEAR (RESET) CR 0 jump (DONE)
|
||||
|
||||
@@ -135,7 +135,8 @@ set HDR-NFA here ", WARM #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
|
||||
\ ( -- ) the system as it was when the capsule had just been loaded:
|
||||
\ everything defined since is gone, there is one vocabulary, numbers are
|
||||
\ decimal, the block buffers are empty. Then as WARM.
|
||||
\ decimal, the block buffers are empty. A word in (GONE-HOOK) that COLD
|
||||
\ forgets is taken out of it (quit.f18, (DOWN)). Then as WARM.
|
||||
set HDR-NFA here ", COLD #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: COLD
|
||||
(BOOT) a! @ DP a! !
|
||||
@@ -144,6 +145,10 @@ set HDR-NFA here ", COLD #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
(LATEST) CONTEXT a! ! (LATEST) CURRENT a! ! 0 VOC-LINK a! !
|
||||
10 BASE a! ! 0 SCR a! ! 2 (LOG-LEVEL) a! ! 0 (ACL-HOOK) a! ! EMPTY-BUFFERS
|
||||
(BOOT) a! @ 2/ 2/ (FORGOTTEN) \ the kernel's records of what has gone go too (dict.f18)
|
||||
(GONE-HOOK) a! @ (BOOT) b! @b 2/ 2/ inv 1 + + \ the hook's xt less the sealed HERE, in cells
|
||||
-if CLEAR drop jump KEPT \ below the sealed system: it stays (0 is below)
|
||||
CLEAR: drop 0 (GONE-HOOK) a! ! \ at or above it: forgotten with what COLD forgets
|
||||
KEPT:
|
||||
$54524F46 (EMIT4) $39372D48 (EMIT4) $6C6F4320 (EMIT4) $74532064 (EMIT4) $747261 (EMIT4) CR
|
||||
$74737953 (EMIT4) $69206D65 (EMIT4) $6974696E (EMIT4) $7A696C61 (EMIT4) $2E6465 (EMIT4) CR
|
||||
jump ABORT
|
||||
|
||||
+3
-1
@@ -119,7 +119,7 @@
|
||||
/* THE IMAGE RECORD: where the system's source says, with `store`, the addresses a host needs (v4/image.h): where the
|
||||
* node waits for a message, its fault table, and KEY's code. */
|
||||
#define ROM_IMG (BUF0_W - 119) /* idle, fault table, KEY, the word after KEY: 4 cells */
|
||||
/* FREE, plain memory: BUF0_W - 22 .. - 21; - 115 .. - 113; BUF0_W - 144 .. - 141 (what a flush makes zero after
|
||||
/* FREE, plain memory: BUF0_W - 22; - 115 .. - 113; BUF0_W - 144 .. - 141 (what a flush makes zero after
|
||||
* a full output buffer); and OUT_W - 144 .. OUT_W - 65. They and
|
||||
* the cells above held the messages waiting, the refusals owed and what went with them (MESH.md 7a, 7b), which a
|
||||
* node no longer keeps. */
|
||||
@@ -205,6 +205,7 @@ enum { V4_ROM_ERRORS(ROM_ERR_ENUM_) ROM_ERR_END_ };
|
||||
#define ROM_ADDR_TOP ((v4_cell)(V4_NODE_WORDS + V4_ROM_WORDS - 1u)) /* the top of the address space */
|
||||
#define WORD_DEFINED (BUF0_W - 11) /* the xt of the word that is told of each new entry, or 0 */
|
||||
#define WORD_FORGOTTEN (BUF0_W - 12) /* the xt of the word that is told when entries go, or 0 */
|
||||
#define GONE_HOOK (BUF0_W - 21) /* the xt of the word a believed GONE is handed to, or 0 (MESH.md 9a.2, ruling 7) */
|
||||
#define LOG_LEVEL (BUF0_W - 5) /* the level at or below which a message is printed */
|
||||
#define BOOT_CELLS (BVARS + 14) /* (BOOT): DP and LATEST as the loader left them, 2 cells */
|
||||
#define BUF0_W (BVARS - (v4_cell)(V4_BLOCK_SLOTS * V4_BLOCK_CELLS)) /* the block window: the kernel's slots, 256 cells each (v4/blocks.h) */
|
||||
@@ -330,6 +331,7 @@ static unsigned host_branch_slots(void)
|
||||
X("(OUT)", OUT_W) \
|
||||
X("(WORD-DEFINED)", WORD_DEFINED) \
|
||||
X("(WORD-FORGOTTEN)", WORD_FORGOTTEN) \
|
||||
X("(GONE-HOOK)", GONE_HOOK) \
|
||||
X("BLOCK#", V4_REQ_BLOCK) /* the kernel's block requests (v4/blocks.h) */ \
|
||||
X("BUFFER#", V4_REQ_BUFFER) \
|
||||
X("UPDATE#", V4_REQ_UPDATE) \
|
||||
|
||||
@@ -1096,6 +1096,26 @@ int main(void)
|
||||
CHECK(undone == 0 && wrong == 0, "whenever the room came, both texts were done, the first first: %u not done, %u in the wrong order, the first when it came at step %u", undone, wrong, first_wrong);
|
||||
}
|
||||
|
||||
/* ---- A BELIEVED GONE IS HANDED ON (MESH.md 9a.2, ruling 7; 9a.3) ----
|
||||
* The word in (GONE-HOOK) is given the number of the node that is gone, each time a GONE is believed:
|
||||
* centre.4th puts GONE-DOWN there, which tells the nodes the node birthed. Here node 11 has a word that
|
||||
* tells node 12; node 12 believes it, since node 11 is its centre, and forgets its way to 44. */
|
||||
CHECK(row() && told(12, "44 2 ROUTE") && told(11, "44 3 ROUTE"), "a row; nodes 11 and 12 each know a way to 44");
|
||||
{
|
||||
v4_cell ways11 = pool[mid].n.mem[ROUTE_COUNT], ways12 = pool[far].n.mem[ROUTE_COUNT];
|
||||
CHECK(told(10, "44 11 GONE") && pool[mid].n.mem[ROUTE_COUNT] == ways11 - 1 && pool[far].n.mem[ROUTE_COUNT] == ways12 && asleep(far),
|
||||
"with nothing in (GONE-HOOK) node 11 believes a GONE from its centre and tells no one");
|
||||
CHECK(told(11, "44 3 ROUTE : DOWN 12 GONE ; ' DOWN (GONE-HOOK) !"), "node 11 is given a word to hand a GONE on with");
|
||||
CHECK(told(10, "44 11 GONE") && pool[mid].n.mem[ROUTE_COUNT] == ways11 - 1 && pool[far].n.mem[ROUTE_COUNT] == ways12 - 1 && asleep(far) && asleep(mid),
|
||||
"now node 11 believes it and hands it on: node 12 believes it from its centre and forgets 44 too");
|
||||
CHECK(told(12, "44 2 ROUTE") && told(11, "44 3 ROUTE") && told(12, "44 12 GONE") && pool[mid].n.mem[ROUTE_COUNT] == ways11,
|
||||
"a GONE that is not believed -- node 12 is not node 11's centre -- is not handed on");
|
||||
CHECK(v4_fabric_wire_kernel(&f, mid, 0, &kernel_dev), "a kernel on node 11's port 0, for COLD's EMPTY-BUFFERS");
|
||||
CHECK(strstr(tell(11, "COLD"), "Cold Start") != NULL && strcmp(tell(11, "(GONE-HOOK) @ ."), "0 ") == 0,
|
||||
"COLD forgets DOWN, so (GONE-HOOK) no longer points at it: \"%s\"", printed);
|
||||
CHECK(strcmp(tell(10, "1 2 + ."), "3 ") == 0 && strcmp(tell(11, "1 2 + ."), "3 ") == 0 && strcmp(tell(12, "1 2 + ."), "3 ") == 0, "and every node answers");
|
||||
}
|
||||
|
||||
/* ---- A NODE REMOVED, OR A WIRE CUT, AT EVERY STEP (MESH.md 7d.7, acceptance 6) ----
|
||||
* Three exchanges, each played once whole and then once for every step it takes with node 11 removed at
|
||||
* that step, again with node 12 removed, and again with the wire between them cut and made again: the
|
||||
|
||||
Reference in New Issue
Block a user