Capsule blocks steps 3+4 for v4: capsules are placed in RAM and load their lowest block
Captain Bob ruled: Block n lands at n-R; the lowest block is interpreted; chaining is the developer's; together, v4 first. - v4_blocks_place_capsule copies each Block n into RAM block n - R as 16 lines of 64, space-padded, in any file order. A later block of the same number overwrites. It refuses a block below R. - The mesh's load(), its capsule reader (CAPSULE-OPEN/(LINES), so a child's forth79.4th via BIRTH too), boot.c and test_host_unit's model each place a capsule, then interpret "<lowest> LOAD". - mkdictionary.py skips --> when it types capsules at the hosted prompt. - The v4 capsules are renumbered into R..2R-1, landing at RAM 1900 and up, away from POST's blocks 0-5. Each is chained with -->, and centre.4th's gap at 8103 is closed. Test first: - test_host_blocks.c gained 6 placement checks; it failed to build before. - test_mesh_boot.c checks forth79's lowest block in RAM block 1900; it failed before. After: POST is 990/990; all 52 tests at 64 bits, test-32, hosted-check and ASan/UBSan pass; the amd64 kernel builds; the dictionary has 404 words. Logs are in logs/20261118-capsule-place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+24
-24
@@ -29,11 +29,11 @@
|
||||
| `sdk.4th` | 5109, 5110, 5111, 5112, 5113, 5114, 5115 | `0x008fdbbb62c94a3a` | n/a |
|
||||
| `turtle.4th` | 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108 | `0x4d470418ca543365` | n/a |
|
||||
| `user-font-demo.4th` | 4200, 4201, 4202 | `0xce1fd7d1b581a56d` | n/a |
|
||||
| `v4:centre.4th` | 8100, 8101, 8102, 8104, 8105, 8106, 8107 | `0xccd1b28a101c78b2` | n/a |
|
||||
| `v4:forth79.4th` | 6000, 6001, 6002 | `0x4055641ee17d176b` | n/a |
|
||||
| `v4:hera.4th` | 8000, 8001 | `0x85300ad4e6e8b86b` | n/a |
|
||||
| `v4:physics.4th` | 8200, 8201, 8202, 8203, 8204 | `0x747d89ca8d57e29c` | n/a |
|
||||
| `v4:starshipos.4th` | 7000, 7001 | `0x5658ee1b771b5963` | n/a |
|
||||
| `v4:centre.4th` | 3964, 3965, 3966, 3967, 3968, 3969, 3970 | `0xea5815290d56dff3` | n/a |
|
||||
| `v4:forth79.4th` | 3948, 3949, 3950 | `0x4609d6ef54166ef8` | n/a |
|
||||
| `v4:hera.4th` | 3960, 3961 | `0x78730b1d6effe892` | n/a |
|
||||
| `v4:physics.4th` | 3972, 3973, 3974, 3975, 3976 | `0x5b0195fc30828bde` | n/a |
|
||||
| `v4:starshipos.4th` | 3956, 3957 | `0x1734a8f4fe7483a5` | n/a |
|
||||
| `workload-0.4th` | 2200, 2201 | `0x93f86f60aeba8feb` | n/a |
|
||||
| `workload-1-lite.4th` | 5058, 5059 | `0x44a7a7e3176dcc8d` | n/a |
|
||||
| `workload-1.4th` | 4406, 4415, 4425, 4435 | `0x63e251adb0a03613` | n/a |
|
||||
@@ -105,6 +105,25 @@
|
||||
| 2160 | `workload-8.4th` | `0x56b7f2f0efa000df` | ok |
|
||||
| 2200 | `workload-0.4th` | `0x93f86f60aeba8feb` | ok |
|
||||
| 2201 | `workload-0.4th` | `0x93f86f60aeba8feb` | ok |
|
||||
| 3948 | `v4:forth79.4th` | `0x4609d6ef54166ef8` | ok |
|
||||
| 3949 | `v4:forth79.4th` | `0x4609d6ef54166ef8` | ok |
|
||||
| 3950 | `v4:forth79.4th` | `0x4609d6ef54166ef8` | ok |
|
||||
| 3956 | `v4:starshipos.4th` | `0x1734a8f4fe7483a5` | ok |
|
||||
| 3957 | `v4:starshipos.4th` | `0x1734a8f4fe7483a5` | ok |
|
||||
| 3960 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3961 | `v4:hera.4th` | `0x78730b1d6effe892` | ok |
|
||||
| 3964 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3965 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3966 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3967 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3968 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3969 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3970 | `v4:centre.4th` | `0xea5815290d56dff3` | ok |
|
||||
| 3972 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3973 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3974 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3975 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 3976 | `v4:physics.4th` | `0x5b0195fc30828bde` | ok |
|
||||
| 4000 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4001 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
| 4002 | `ACL.4th` | `0xf8890c05c0d8f921` | ok |
|
||||
@@ -366,25 +385,6 @@
|
||||
| 5113 | `sdk.4th` | `0x008fdbbb62c94a3a` | ok |
|
||||
| 5114 | `sdk.4th` | `0x008fdbbb62c94a3a` | ok |
|
||||
| 5115 | `sdk.4th` | `0x008fdbbb62c94a3a` | ok |
|
||||
| 6000 | `v4:forth79.4th` | `0x4055641ee17d176b` | ok |
|
||||
| 6001 | `v4:forth79.4th` | `0x4055641ee17d176b` | ok |
|
||||
| 6002 | `v4:forth79.4th` | `0x4055641ee17d176b` | ok |
|
||||
| 7000 | `v4:starshipos.4th` | `0x5658ee1b771b5963` | ok |
|
||||
| 7001 | `v4:starshipos.4th` | `0x5658ee1b771b5963` | ok |
|
||||
| 8000 | `v4:hera.4th` | `0x85300ad4e6e8b86b` | ok |
|
||||
| 8001 | `v4:hera.4th` | `0x85300ad4e6e8b86b` | ok |
|
||||
| 8100 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8101 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8102 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8104 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8105 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8106 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8107 | `v4:centre.4th` | `0xccd1b28a101c78b2` | ok |
|
||||
| 8200 | `v4:physics.4th` | `0x747d89ca8d57e29c` | ok |
|
||||
| 8201 | `v4:physics.4th` | `0x747d89ca8d57e29c` | ok |
|
||||
| 8202 | `v4:physics.4th` | `0x747d89ca8d57e29c` | ok |
|
||||
| 8203 | `v4:physics.4th` | `0x747d89ca8d57e29c` | ok |
|
||||
| 8204 | `v4:physics.4th` | `0x747d89ca8d57e29c` | ok |
|
||||
|
||||
---
|
||||
*40 capsule(s) scanned. Re-run `mkcapsule --manifest <dir>` to refresh.*
|
||||
|
||||
+13
-7
@@ -1,4 +1,4 @@
|
||||
Block 8100
|
||||
Block 3964
|
||||
( centre.4th -- what a node that births others needs. )
|
||||
( docs/v4.0.0/MESH.md 9a. Births follow v3: any node may )
|
||||
( birth on its own ports, and is its children's parent. )
|
||||
@@ -14,7 +14,8 @@ VARIABLE (T#)
|
||||
: (TC) ( c -- ) PAD (T#) @ + C! 1 (T#) +! ;
|
||||
: (TS) ( baddr u -- )
|
||||
DUP IF 0 DO DUP I + C@ (TC) LOOP DROP ELSE DROP DROP THEN ;
|
||||
Block 8101
|
||||
-->
|
||||
Block 3965
|
||||
: (TN) ( n -- ) 0 <# #S #> (TS) 32 (TC) ;
|
||||
: (T) ( -- baddr u ) PAD (T#) @ ;
|
||||
( The node being born: its number, its place, the port of )
|
||||
@@ -27,7 +28,8 @@ VARIABLE (KIDC) VARIABLE (PERS) VARIABLE (PERS#)
|
||||
-1 NODE-ERROR ! ;
|
||||
: (TOLD) ( how -- ) 1 - IF (FAIL) THEN ;
|
||||
: (TELL) ( baddr u -- ) (KID#) @ SEND (KID#) @ AWAIT (TOLD) ;
|
||||
Block 8102
|
||||
-->
|
||||
Block 3966
|
||||
( the system, a capsule of F18 code, cell by cell to its port )
|
||||
: (NUCLEUS) ( -- )
|
||||
S" v4:nucleus-64.f18" CAPSULE-OPEN 0= IF (FAIL) THEN
|
||||
@@ -36,7 +38,8 @@ Block 8102
|
||||
: (LINES) ( baddr u -- ) CAPSULE-OPEN 0= IF (FAIL) THEN
|
||||
BEGIN PAD CAPSULE-LINE DUP 0< 0= WHILE PAD SWAP (TELL) REPEAT
|
||||
DROP ;
|
||||
Block 8104
|
||||
-->
|
||||
Block 3967
|
||||
( Who it is, where its printing goes, which of its ports )
|
||||
( leads to everything it is not told of, and who is there. )
|
||||
: (WHO) ( -- )
|
||||
@@ -45,7 +48,8 @@ Block 8104
|
||||
(KIDC) @ (TN) S" DEFAULT-ROUTE " (TS)
|
||||
(ME) @ (TN) (KIDC) @ (TN) S" NEIGHBOUR" (TS)
|
||||
(T) 0 (KIDP) @ SEND-ON (KID#) @ AWAIT (TOLD) ;
|
||||
Block 8105
|
||||
-->
|
||||
Block 3968
|
||||
( number port childport baddr u -- place A NODE IS BORN, )
|
||||
( its port childport joined to this one's port: empty, then )
|
||||
( the system, FORTH-79, and its personality if u is not 0. )
|
||||
@@ -60,7 +64,8 @@ Block 8105
|
||||
S" (SEAL)" (TELL)
|
||||
(KID) @ (KID#) @ NODE-PARITY
|
||||
(KID) @ ;
|
||||
Block 8106
|
||||
-->
|
||||
Block 3969
|
||||
( number port childport -- place a node with no capsule )
|
||||
: BIRTH 0 0 BIRTH-AS ;
|
||||
( Two outer nodes are joined: port 3 of X to port 4 of Y, )
|
||||
@@ -74,7 +79,8 @@ VARIABLE (XP) VARIABLE (XN) VARIABLE (YP) VARIABLE (YN)
|
||||
: (JOIN) ( -- )
|
||||
(XP) @ 3 (YP) @ 4 NODE-WIRE 0= IF (FAIL) THEN
|
||||
(YN) @ 3 (XN) @ (SAY) (XN) @ 4 (YN) @ (SAY) ;
|
||||
Block 8107
|
||||
-->
|
||||
Block 3970
|
||||
( n -- A UNIT: four outer nodes, n+1 to n+4, on ports 2 )
|
||||
( to 5 of this one, each by its own port 2, and joined in a )
|
||||
( square: 1-2, 2-4, 4-3, 3-1. )
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Block 6000
|
||||
Block 3948
|
||||
( forth79.4th -- the FORTH-79 Required Word Set for v4, )
|
||||
( as colon definitions, loaded when the system boots. )
|
||||
( docs/v4.0.0/NUCLEUS.md. Blocks 6000 up. )
|
||||
( docs/v4.0.0/NUCLEUS.md. Blocks 3948 up. )
|
||||
( A word moves here from the assembled nucleus, v4/capsule, )
|
||||
( once its colon definition passes POST. )
|
||||
Block 6001
|
||||
-->
|
||||
Block 3949
|
||||
( U* U/MOD -- FORTH-79 unsigned multiply and divide. )
|
||||
( Neither v3 nor the v4 nucleus had them. )
|
||||
( The first two words count the bits in a cell. )
|
||||
@@ -14,7 +15,8 @@ Block 6001
|
||||
VARIABLE (UD)
|
||||
( u1 u2 -- ud the unsigned double product )
|
||||
: U* UM* ;
|
||||
Block 6002
|
||||
-->
|
||||
Block 3950
|
||||
( ud u1 -- u2 u3 unsigned: u2 the remainder, u3 the quotient )
|
||||
( One bit a step: shift ud left, and take u1 from its high )
|
||||
( cell whenever it goes, counting that in the low cell. )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Block 8000
|
||||
Block 3960
|
||||
( hera.4th -- what is Hera's alone, beside centre.4th, which )
|
||||
( she loads first. docs/v4.0.0/MESH.md 9a. She decides )
|
||||
( which nodes there are and which are awake: KILL, PAUSE and )
|
||||
@@ -14,7 +14,8 @@ Block 8000
|
||||
: KILL ( n -- )
|
||||
(THERE?) 0= IF ." KILL: " (NO-NODE) THEN
|
||||
DUP NODE-KILL NO-ROUTE ;
|
||||
Block 8001
|
||||
-->
|
||||
Block 3961
|
||||
: PAUSE ( n -- )
|
||||
(THERE?) 0= IF ." PAUSE: " (NO-NODE) THEN NODE-SLEEP ;
|
||||
: RESUME ( n -- )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Block 8200
|
||||
Block 3972
|
||||
( physics.4th -- the words of the loops, v3's physics-freeze )
|
||||
( and inference words, on a node the kernel keeps records )
|
||||
( for: each asks its kernel, which keeps every word's and )
|
||||
@@ -14,7 +14,8 @@ Block 8200
|
||||
-27 KERNEL-WORD INFER-DECAY-SLOPE ( addr u -- d )
|
||||
-28 KERNEL-WORD INFER-WINDOW-WIDTH ( addr u -- n )
|
||||
-29 KERNEL-WORD INFER-RUN ( -- )
|
||||
Block 8201
|
||||
-->
|
||||
Block 3973
|
||||
( and what the last INFER-RUN, or the heartbeat's, found; )
|
||||
( a q is a Q48.16 double, as qmath.f18's )
|
||||
-30 KERNEL-WORD INFER-WINDOW@ ( -- u )
|
||||
@@ -24,7 +25,8 @@ Block 8201
|
||||
-34 KERNEL-WORD INFER-EARLY-EXIT@ ( -- flag )
|
||||
( v3's DECAY_RATE_PER_US_Q16, its compile-time constant )
|
||||
1 CONSTANT DECAY-RATE@
|
||||
Block 8202
|
||||
-->
|
||||
Block 3974
|
||||
( v3's StarForth module: a word's execution heat, by the )
|
||||
( address ' leaves; and the hottest -- the kernel's records )
|
||||
-35 KERNEL-WORD ENTROPY@ ( addr -- n )
|
||||
@@ -40,7 +42,8 @@ Block 8202
|
||||
." ==================================" CR
|
||||
(HOT#) MIN 0 ?DO I (HOT) SWAP I 1+ 0 .R ." . "
|
||||
>NAME COUNT TYPE ." : " 0 .R CR LOOP ;
|
||||
Block 8203
|
||||
-->
|
||||
Block 3975
|
||||
( WORD-ENTROPY: every word with heat, then the totals, as v3 )
|
||||
VARIABLE (WE-T) VARIABLE (WE-N)
|
||||
: WORD-ENTROPY ( -- )
|
||||
@@ -56,7 +59,8 @@ VARIABLE (WE-T) VARIABLE (WE-N)
|
||||
." Total words: " (WE-N) @ 0 .R CR
|
||||
(WE-T) @ IF ." Average executions per word: "
|
||||
(WE-T) @ (WE-N) @ / 0 .R CR THEN ;
|
||||
Block 8204
|
||||
-->
|
||||
Block 3976
|
||||
( (- skips its input to the matching close paren, nesting, )
|
||||
( as v3's code does -- its documentation says to the line end )
|
||||
: (- ( -- ) 1
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
Block 7000
|
||||
Block 3956
|
||||
( starshipos.4th -- the StarshipOS words, in their own )
|
||||
( vocabulary, STARSHIPOS: not FORTH-79, so not in FORTH. )
|
||||
( Loaded when the system boots, after forth79.4th. )
|
||||
( Blocks 7000 up. New definitions still go into FORTH; the )
|
||||
( Blocks 3956 up. New definitions still go into FORTH; the )
|
||||
( search starts in STARSHIPOS once init.4th sets it. )
|
||||
VOCABULARY STARSHIPOS STARSHIPOS DEFINITIONS
|
||||
Block 7001
|
||||
-->
|
||||
Block 3957
|
||||
( DOE baddr u -- as S" name" DOE )
|
||||
( Intended: run the DoE of that name, from the capsule of )
|
||||
( that name. As yet it only types the name back -- asked for )
|
||||
|
||||
Reference in New Issue
Block a user