v4: COLD keeps the vocabularies as sealed -- FORGET's prune, shared
COLD set VOC-LINK to 0, assuming the sealed system has one vocabulary. With starshipos.4th sealed in, STARSHIPOS fell out of the chain after COLD. A word defined in it then forgotten, or COLDed away, hung the node. ACL-INIT-PRIMITIVES would also have skipped its words. FORGET's loop is now (PRUNE-ALL). It drops the vocabularies above (Q) and prunes the lists of those that stay. FORGET calls it as before, and COLD calls it with the sealed DP. No new cell and no new word. Test first in test_mesh_boot.c: FORGET and COLD of a word in STARSHIPOS, and STARSHIPOS's own words staying. The before-run hung and was stopped at 500 s. After: 109 checks pass, POST is 990/990, all 52 64-bit tests and test-32 pass, ASan/UBSan are clean, and the amd64 build is clean. Found by Captain Bob's "make sure we're not applying incorrect logic". Ruled: fix first, then the protocol. Logs are in logs/20261118-cold-vocabularies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -95,6 +95,19 @@ set HDR-NFA here ", VLIST #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK he
|
||||
CUT: drop -1 + a! @ (Q)+1 a! @ a! ! jump L
|
||||
DONE: drop ;
|
||||
|
||||
\ ( -- ) take off every list every entry at or above the address in (Q)+0:
|
||||
\ FORTH's, and each vocabulary's that stays; a vocabulary defined at or above
|
||||
\ it goes from the chain. FORGET does this for what it forgets, and COLD for
|
||||
\ everything since the seal, so a vocabulary sealed into the system stays.
|
||||
: (PRUNE-ALL)
|
||||
(LATEST) (PRUNE)
|
||||
V: VOC-LINK a! @ if PRUNED \ vocabularies that go
|
||||
dup (Q) a! @ inv + 1 + -if GONE drop jump KEPT
|
||||
GONE: drop 1 + a! @ VOC-LINK a! ! jump V
|
||||
KEPT: P: if PRUNED \ the lists of those that stay
|
||||
dup (PRUNE) 1 + a! @ jump P
|
||||
PRUNED: drop ;
|
||||
|
||||
\ FORGET xxx FORTH-79: remove xxx and every word defined after it, in
|
||||
\ whatever vocabulary; the space they took is free again. A vocabulary that
|
||||
\ goes is no longer CONTEXT or CURRENT: FORTH is. A word that is not there
|
||||
@@ -108,13 +121,7 @@ set HDR-NFA here ", FORGET #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK h
|
||||
drop drop NODE-ERROR b! 10 !b ;
|
||||
OK: drop
|
||||
dup (Q) a! ! 4* DP a! ! \ the space from its name on
|
||||
(LATEST) (PRUNE)
|
||||
V: VOC-LINK a! @ if PRUNED \ vocabularies that go
|
||||
dup (Q) a! @ inv + 1 + -if GONE drop jump KEPT
|
||||
GONE: drop 1 + a! @ VOC-LINK a! ! jump V
|
||||
KEPT: P: if PRUNED \ the lists of those that stay
|
||||
dup (PRUNE) 1 + a! @ jump P
|
||||
PRUNED: drop
|
||||
(PRUNE-ALL)
|
||||
CONTEXT a! @ (Q) a! @ inv + 1 + -if C1 drop jump C2
|
||||
C1: drop (LATEST) CONTEXT a! !
|
||||
C2: CURRENT a! @ (Q) a! @ inv + 1 + -if C3 drop jump TOLD
|
||||
@@ -150,7 +157,7 @@ set HDR-NFA here ", WARM #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK her
|
||||
jump ABORT
|
||||
|
||||
\ ( -- ) the system as it was when the capsule had just been loaded:
|
||||
\ everything defined since is gone, there is one vocabulary, numbers are
|
||||
\ everything defined since is gone, the vocabularies are as sealed, numbers are
|
||||
\ decimal, the block buffers are empty. Then as WARM.
|
||||
set HDR-NFA here ", COLD #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: COLD
|
||||
@@ -158,7 +165,8 @@ set HDR-NFA here ", COLD #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK her
|
||||
(BOOT)+1 a! @ (LATEST) a! !
|
||||
(BOOT) a! @ 2/ 2/ (FENCE) a! !
|
||||
(BOOT-ID) a! @ (NEXT-ID) a! !
|
||||
(LATEST) CONTEXT a! ! (LATEST) CURRENT a! ! 0 VOC-LINK a! !
|
||||
(LATEST) CONTEXT a! ! (LATEST) CURRENT a! !
|
||||
(BOOT) a! @ 2/ 2/ (Q) a! ! (PRUNE-ALL) \ the vocabularies as sealed, with what was sealed in them
|
||||
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)
|
||||
$54524F46 (EMIT4) $39372D48 (EMIT4) $6C6F4320 (EMIT4) $74532064 (EMIT4) $747261 (EMIT4) CR
|
||||
|
||||
Reference in New Issue
Block a user