feat(v4): Phase 7 Task 2b -- pipelining and the hot-words cache, built, off as v3 (#189)
Rulings, Captain Bob 2026-11-13: "Build a hot-words cache"; then, v3 being found to have both off (ENABLE_PIPELINING, ENABLE_HOTWORDS_CACHE: n in Kconfig.physics and kernel/Makefile), "Built, off as v3". - The kernel, at every call (mesh.c): v3's hit check, the transition, the likeliest next word (kept as each count rises; v3 scans 1024 a call -- the same word but in a tie v3's Q48.16 rounding makes), speculation at v3's thresholds into the node's cache; a word past heat 50 promoted at its call (v3 promotes at a lookup; v4's heat is the kernel's). Counters from the owner's heap, given back when a word goes. - The node (dict.f18): (LOOKUP) tries (HOT)'s xts first, in F18, calling only C@; the kernel keeps it true (entries that go, or whose name is defined again, taken out). Empty unless the build has the cache. - Tests: test_mesh_boot.c as built (57 checks) and with both on (mesh-boot-on, 65). v4 test: all pass. - Reported, v3's own: when full, its promote takes the next slot without looking for the word there (a few hot words churn all 32 slots); its prefetch misses are never counted. Both reproduced. - amd64 boots, RESULT: PASS, but 174 s and 181 s against 2a's 146 s, while on the host the mesh boot is no slower: being measured. Not pushed (held to the Phase 7 boundary). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -201,11 +201,35 @@ set HDR-NFA here ", (TELL-FORGOTTEN) #id, #, 0 #, HDR-NFA #, HDR-LINK set
|
||||
\ name fetched, the two names compared byte by byte -- so that the only call
|
||||
\ it makes is C@: it is called from the interpreter for every word of every
|
||||
\ line, with the user's return stack beneath it.
|
||||
\ THE HOT-WORDS CACHE first (v3's hotwords_cache_lookup; #189 Phase 7, Captain
|
||||
\ Bob 2026-11-13: "Build a hot-words cache", "Built, off as v3"): (HOT) holds
|
||||
\ its count, the kernel's next slot, this word's index, then up to 32 xts the
|
||||
\ kernel has put there. A visible one with the name is the answer; then the
|
||||
\ dictionary, as before. The kernel keeps it true: an entry that goes, or
|
||||
\ one whose name is defined again, it takes out. Empty unless the kernel's
|
||||
\ build has ENABLE_HOTWORDS_CACHE.
|
||||
: (LOOKUP)
|
||||
dup (D)+1 a! ! \ cut the string to 31 characters
|
||||
C@ -32 + -if LONG drop jump CUT
|
||||
LONG: drop 31 (D)+1 a! @ C!
|
||||
CUT:
|
||||
0 (HOT)+2 a! !
|
||||
H: (HOT)+2 a! @ (HOT) a! @ xor if HDONE drop
|
||||
(HOT)+2 a! @ dup 1 + ! \ i, and i + 1 kept
|
||||
(HOT)+3 + a! @ if HNONE
|
||||
(D)+2 a! !
|
||||
(D)+2 a! @ -3 + a! @ 2 and if HVIS drop jump H
|
||||
HVIS: drop
|
||||
(D)+2 a! @ -2 + a! @ 4* (D) a! ! \ its name
|
||||
(D)+1 a! @ C@ 1 + (D)+3 a! !
|
||||
HC: (D)+3 a! @ if HSAME -1 + dup !
|
||||
dup (D) a! @ + C@
|
||||
SWAP (D)+1 a! @ + C@
|
||||
xor if HEQ drop jump H
|
||||
HEQ: drop jump HC
|
||||
HSAME: drop (D)+2 a! @ ;
|
||||
HNONE: drop jump H
|
||||
HDONE: drop
|
||||
0 (D)+4 a! ! \ not yet on to FORTH
|
||||
CONTEXT a! @ a! @
|
||||
L: if END
|
||||
|
||||
+69
-68
@@ -22,81 +22,82 @@ constant CG-BSLOTS 3
|
||||
constant STATE 16371
|
||||
constant (C) 16322
|
||||
constant (CFP) 16370
|
||||
constant (Q) 14708
|
||||
constant (Q) 14673
|
||||
constant (F) 16279
|
||||
constant (S) 15812
|
||||
constant (W) 16285
|
||||
constant (X) 15792
|
||||
constant (BOOT) 15750
|
||||
constant (NEXT-ID) 15746
|
||||
constant (BOOT-ID) 15747
|
||||
constant (LOG-LEVEL) 14707
|
||||
constant (ACL-HOOK) 14706
|
||||
constant SCR 15742
|
||||
constant BLK 15743
|
||||
constant (SRC) 15744
|
||||
constant (SRC-HOOK) 15745
|
||||
constant (LINE-STATUS) 14703
|
||||
constant (PORT) 14572
|
||||
constant (ME) 14699
|
||||
constant (CONSOLE) 14696
|
||||
constant (ROUTE#) 14695
|
||||
constant (ROUTE-DEFAULT) 14694
|
||||
constant (LOST) 14693
|
||||
constant (PRINT-TO) 14692
|
||||
constant (PRINT-PORT) 14679
|
||||
constant (DONE-PORT) 14678
|
||||
constant (ROUTES) 14616
|
||||
constant (HOT) 15757
|
||||
constant (BOOT) 15715
|
||||
constant (NEXT-ID) 15711
|
||||
constant (BOOT-ID) 15712
|
||||
constant (LOG-LEVEL) 14672
|
||||
constant (ACL-HOOK) 14671
|
||||
constant SCR 15707
|
||||
constant BLK 15708
|
||||
constant (SRC) 15709
|
||||
constant (SRC-HOOK) 15710
|
||||
constant (LINE-STATUS) 14668
|
||||
constant (PORT) 14537
|
||||
constant (ME) 14664
|
||||
constant (CONSOLE) 14661
|
||||
constant (ROUTE#) 14660
|
||||
constant (ROUTE-DEFAULT) 14659
|
||||
constant (LOST) 14658
|
||||
constant (PRINT-TO) 14657
|
||||
constant (PRINT-PORT) 14644
|
||||
constant (DONE-PORT) 14643
|
||||
constant (ROUTES) 14581
|
||||
constant -PORTS -8
|
||||
constant (NEAR) 14648
|
||||
constant (AWAIT-FROM) 14673
|
||||
constant (WIRE) 14584
|
||||
constant (WIRE-A) 14585
|
||||
constant (WIRE-B) 14586
|
||||
constant (WIRE-DO) 14587
|
||||
constant (WIRE-HOW) 14588
|
||||
constant (WIRE-HAVE) 14589
|
||||
constant (S-HAVE) 14677
|
||||
constant (S-MASK) 14676
|
||||
constant (S-WIRE) 14675
|
||||
constant (S-ON) 14674
|
||||
constant (KEEP) 14672
|
||||
constant (DEFER) 14671
|
||||
constant (D-MASK) 14704
|
||||
constant (IN) 14656
|
||||
constant (ONE) 14663
|
||||
constant (OUT-HDR) 14600
|
||||
constant (W-NEED) 14607
|
||||
constant (W-PORT) 14608
|
||||
constant (P-WAY) 14609
|
||||
constant (P-NEED) 14612
|
||||
constant (H-PORT) 14613
|
||||
constant (H-NEED) 14614
|
||||
constant (H-MASK) 14615
|
||||
constant (A-SELF) 14610
|
||||
constant (SEND^) 14611
|
||||
constant (OUT-TEXT) 14248
|
||||
constant (SEND-TEXT) 13912
|
||||
constant (QUIET) 14702
|
||||
constant (REFUSED) 14705
|
||||
constant (OUT^) 14698
|
||||
constant (REPLY) 14697
|
||||
constant (MSG) 14664
|
||||
constant (OUT) 14312
|
||||
constant (WORD-DEFINED) 14701
|
||||
constant (WORD-FORGOTTEN) 14700
|
||||
constant (NEAR) 14613
|
||||
constant (AWAIT-FROM) 14638
|
||||
constant (WIRE) 14549
|
||||
constant (WIRE-A) 14550
|
||||
constant (WIRE-B) 14551
|
||||
constant (WIRE-DO) 14552
|
||||
constant (WIRE-HOW) 14553
|
||||
constant (WIRE-HAVE) 14554
|
||||
constant (S-HAVE) 14642
|
||||
constant (S-MASK) 14641
|
||||
constant (S-WIRE) 14640
|
||||
constant (S-ON) 14639
|
||||
constant (KEEP) 14637
|
||||
constant (DEFER) 14636
|
||||
constant (D-MASK) 14669
|
||||
constant (IN) 14621
|
||||
constant (ONE) 14628
|
||||
constant (OUT-HDR) 14565
|
||||
constant (W-NEED) 14572
|
||||
constant (W-PORT) 14573
|
||||
constant (P-WAY) 14574
|
||||
constant (P-NEED) 14577
|
||||
constant (H-PORT) 14578
|
||||
constant (H-NEED) 14579
|
||||
constant (H-MASK) 14580
|
||||
constant (A-SELF) 14575
|
||||
constant (SEND^) 14576
|
||||
constant (OUT-TEXT) 14213
|
||||
constant (SEND-TEXT) 13877
|
||||
constant (QUIET) 14667
|
||||
constant (REFUSED) 14670
|
||||
constant (OUT^) 14663
|
||||
constant (REPLY) 14662
|
||||
constant (MSG) 14629
|
||||
constant (OUT) 14277
|
||||
constant (WORD-DEFINED) 14666
|
||||
constant (WORD-FORGOTTEN) 14665
|
||||
constant BLOCK# -1
|
||||
constant BUFFER# -2
|
||||
constant UPDATE# -3
|
||||
constant SAVE-BUFFERS# -4
|
||||
constant EMPTY-BUFFERS# -5
|
||||
constant (Q/) 15752
|
||||
constant (QE) 15757
|
||||
constant (QR) 15765
|
||||
constant (QL) 15770
|
||||
constant (QT) 15777
|
||||
constant (QP) 15783
|
||||
constant (DP) 15787
|
||||
constant (Q/) 15717
|
||||
constant (QE) 15722
|
||||
constant (QR) 15730
|
||||
constant (QL) 15735
|
||||
constant (QT) 15742
|
||||
constant (QP) 15748
|
||||
constant (DP) 15752
|
||||
constant ADDR-DIGITS 8
|
||||
constant MSB -2147483648
|
||||
constant MAXHI 2147483647
|
||||
@@ -115,8 +116,8 @@ constant -HFLOOR -63186
|
||||
constant DSTACK-DEPTH 16369
|
||||
constant RSTACK-DEPTH 16368
|
||||
constant HEAT-OP 13824
|
||||
constant (EXEC) 14690
|
||||
constant (RUNX) 14597
|
||||
constant (EXEC) 14655
|
||||
constant (RUNX) 14562
|
||||
constant ANTICLOCK 13856
|
||||
constant CFBASE 16288
|
||||
constant CFEND 16320
|
||||
@@ -127,4 +128,4 @@ constant ROM-DNEGATE 16387
|
||||
constant ROM-Q.* 16388
|
||||
constant ROM-Q./ 16389
|
||||
constant DICT-W 8192
|
||||
constant (IMG) 14593
|
||||
constant (IMG) 14558
|
||||
|
||||
+69
-68
@@ -22,81 +22,82 @@ constant CG-BSLOTS 3
|
||||
constant STATE 16371
|
||||
constant (C) 16322
|
||||
constant (CFP) 16370
|
||||
constant (Q) 14708
|
||||
constant (Q) 14673
|
||||
constant (F) 16279
|
||||
constant (S) 15812
|
||||
constant (W) 16285
|
||||
constant (X) 15792
|
||||
constant (BOOT) 15750
|
||||
constant (NEXT-ID) 15746
|
||||
constant (BOOT-ID) 15747
|
||||
constant (LOG-LEVEL) 14707
|
||||
constant (ACL-HOOK) 14706
|
||||
constant SCR 15742
|
||||
constant BLK 15743
|
||||
constant (SRC) 15744
|
||||
constant (SRC-HOOK) 15745
|
||||
constant (LINE-STATUS) 14703
|
||||
constant (PORT) 14572
|
||||
constant (ME) 14699
|
||||
constant (CONSOLE) 14696
|
||||
constant (ROUTE#) 14695
|
||||
constant (ROUTE-DEFAULT) 14694
|
||||
constant (LOST) 14693
|
||||
constant (PRINT-TO) 14692
|
||||
constant (PRINT-PORT) 14679
|
||||
constant (DONE-PORT) 14678
|
||||
constant (ROUTES) 14616
|
||||
constant (HOT) 15757
|
||||
constant (BOOT) 15715
|
||||
constant (NEXT-ID) 15711
|
||||
constant (BOOT-ID) 15712
|
||||
constant (LOG-LEVEL) 14672
|
||||
constant (ACL-HOOK) 14671
|
||||
constant SCR 15707
|
||||
constant BLK 15708
|
||||
constant (SRC) 15709
|
||||
constant (SRC-HOOK) 15710
|
||||
constant (LINE-STATUS) 14668
|
||||
constant (PORT) 14537
|
||||
constant (ME) 14664
|
||||
constant (CONSOLE) 14661
|
||||
constant (ROUTE#) 14660
|
||||
constant (ROUTE-DEFAULT) 14659
|
||||
constant (LOST) 14658
|
||||
constant (PRINT-TO) 14657
|
||||
constant (PRINT-PORT) 14644
|
||||
constant (DONE-PORT) 14643
|
||||
constant (ROUTES) 14581
|
||||
constant -PORTS -8
|
||||
constant (NEAR) 14648
|
||||
constant (AWAIT-FROM) 14673
|
||||
constant (WIRE) 14584
|
||||
constant (WIRE-A) 14585
|
||||
constant (WIRE-B) 14586
|
||||
constant (WIRE-DO) 14587
|
||||
constant (WIRE-HOW) 14588
|
||||
constant (WIRE-HAVE) 14589
|
||||
constant (S-HAVE) 14677
|
||||
constant (S-MASK) 14676
|
||||
constant (S-WIRE) 14675
|
||||
constant (S-ON) 14674
|
||||
constant (KEEP) 14672
|
||||
constant (DEFER) 14671
|
||||
constant (D-MASK) 14704
|
||||
constant (IN) 14656
|
||||
constant (ONE) 14663
|
||||
constant (OUT-HDR) 14600
|
||||
constant (W-NEED) 14607
|
||||
constant (W-PORT) 14608
|
||||
constant (P-WAY) 14609
|
||||
constant (P-NEED) 14612
|
||||
constant (H-PORT) 14613
|
||||
constant (H-NEED) 14614
|
||||
constant (H-MASK) 14615
|
||||
constant (A-SELF) 14610
|
||||
constant (SEND^) 14611
|
||||
constant (OUT-TEXT) 14248
|
||||
constant (SEND-TEXT) 13912
|
||||
constant (QUIET) 14702
|
||||
constant (REFUSED) 14705
|
||||
constant (OUT^) 14698
|
||||
constant (REPLY) 14697
|
||||
constant (MSG) 14664
|
||||
constant (OUT) 14312
|
||||
constant (WORD-DEFINED) 14701
|
||||
constant (WORD-FORGOTTEN) 14700
|
||||
constant (NEAR) 14613
|
||||
constant (AWAIT-FROM) 14638
|
||||
constant (WIRE) 14549
|
||||
constant (WIRE-A) 14550
|
||||
constant (WIRE-B) 14551
|
||||
constant (WIRE-DO) 14552
|
||||
constant (WIRE-HOW) 14553
|
||||
constant (WIRE-HAVE) 14554
|
||||
constant (S-HAVE) 14642
|
||||
constant (S-MASK) 14641
|
||||
constant (S-WIRE) 14640
|
||||
constant (S-ON) 14639
|
||||
constant (KEEP) 14637
|
||||
constant (DEFER) 14636
|
||||
constant (D-MASK) 14669
|
||||
constant (IN) 14621
|
||||
constant (ONE) 14628
|
||||
constant (OUT-HDR) 14565
|
||||
constant (W-NEED) 14572
|
||||
constant (W-PORT) 14573
|
||||
constant (P-WAY) 14574
|
||||
constant (P-NEED) 14577
|
||||
constant (H-PORT) 14578
|
||||
constant (H-NEED) 14579
|
||||
constant (H-MASK) 14580
|
||||
constant (A-SELF) 14575
|
||||
constant (SEND^) 14576
|
||||
constant (OUT-TEXT) 14213
|
||||
constant (SEND-TEXT) 13877
|
||||
constant (QUIET) 14667
|
||||
constant (REFUSED) 14670
|
||||
constant (OUT^) 14663
|
||||
constant (REPLY) 14662
|
||||
constant (MSG) 14629
|
||||
constant (OUT) 14277
|
||||
constant (WORD-DEFINED) 14666
|
||||
constant (WORD-FORGOTTEN) 14665
|
||||
constant BLOCK# -1
|
||||
constant BUFFER# -2
|
||||
constant UPDATE# -3
|
||||
constant SAVE-BUFFERS# -4
|
||||
constant EMPTY-BUFFERS# -5
|
||||
constant (Q/) 15752
|
||||
constant (QE) 15757
|
||||
constant (QR) 15765
|
||||
constant (QL) 15770
|
||||
constant (QT) 15777
|
||||
constant (QP) 15783
|
||||
constant (DP) 15787
|
||||
constant (Q/) 15717
|
||||
constant (QE) 15722
|
||||
constant (QR) 15730
|
||||
constant (QL) 15735
|
||||
constant (QT) 15742
|
||||
constant (QP) 15748
|
||||
constant (DP) 15752
|
||||
constant ADDR-DIGITS 16
|
||||
constant MSB -9223372036854775808
|
||||
constant MAXHI 9223372036854775807
|
||||
@@ -115,8 +116,8 @@ constant -HFLOOR -63186
|
||||
constant DSTACK-DEPTH 16369
|
||||
constant RSTACK-DEPTH 16368
|
||||
constant HEAT-OP 13824
|
||||
constant (EXEC) 14690
|
||||
constant (RUNX) 14597
|
||||
constant (EXEC) 14655
|
||||
constant (RUNX) 14562
|
||||
constant ANTICLOCK 13856
|
||||
constant CFBASE 16288
|
||||
constant CFEND 16320
|
||||
@@ -127,4 +128,4 @@ constant ROM-DNEGATE 16387
|
||||
constant ROM-Q.* 16388
|
||||
constant ROM-Q./ 16389
|
||||
constant DICT-W 8192
|
||||
constant (IMG) 14593
|
||||
constant (IMG) 14558
|
||||
|
||||
Reference in New Issue
Block a user