Fix >CFA returning incorrect value on hidden words

This commit is contained in:
2026-03-01 15:21:34 +00:00
parent b372ae3d5f
commit f6a24ee3cf

View File

@@ -1119,13 +1119,13 @@
"\64\05\00\00" "\64\05\00\00"
"\04HERE\00\00\00" "\04HERE\00\00\00"
"\02\00\00\00" "\02\00\00\00"
"\30\0e\00\00") "\60\0e\00\00")
(data (i32.const 0x058c) (data (i32.const 0x058c)
"\78\05\00\00" "\78\05\00\00"
"\06LATEST\00" "\06LATEST\00"
"\02\00\00\00" "\02\00\00\00"
"\e0\0d\00\00") "\30\0e\00\00")
(data (i32.const 0x05a0) (data (i32.const 0x05a0)
"\8c\05\00\00" "\8c\05\00\00"
@@ -1287,11 +1287,7 @@
;; => 0x78 bytes ;; => 0x78 bytes
;; : NAME-LEN 4+ C@ 63 AND ; ;; : NAME-LEN 4+ C@ 31 AND ;
;; The 0x3f mask we use here includes the hidden flag, so that FIND
;; never matches a hidden entry as its length will appear to be
;; greater than the maximum length returned by WORD.
(data (i32.const 0x0760) (data (i32.const 0x0760)
"\e8\06\00\00" "\e8\06\00\00"
@@ -1300,7 +1296,7 @@
"\a8\02\00\00" ;; 4+ "\a8\02\00\00" ;; 4+
"\fc\03\00\00" ;; C@ "\fc\03\00\00" ;; C@
"\18\04\00\00" ;; LIT "\18\04\00\00" ;; LIT
"\3f\00\00\00" ;; 63 "\1f\00\00\00" ;; 31
"\8c\03\00\00" ;; AND "\8c\03\00\00" ;; AND
"\0c\04\00\00") ;; EXIT "\0c\04\00\00") ;; EXIT
@@ -1309,7 +1305,7 @@
;; : FIND ( len -- entry ) ;; : FIND ( len -- entry )
;; LATEST @ \ Initial entry ;; LATEST @ \ Initial entry
;; ;;
;; TUCK NAME-LEN \ Get name length ;; TUCK FIND-NAME-LEN \ Get name length
;; OVER = 0BRANCH [52] \ Check for length mismatch ;; OVER = 0BRANCH [52] \ Check for length mismatch
;; OVER 5 + \ Get name address ;; OVER 5 + \ Get name address
;; OVER SWAP WORDBUF STRING= \ Check if name matches ;; OVER SWAP WORDBUF STRING= \ Check if name matches
@@ -1329,7 +1325,7 @@
"\98\05\00\00" ;; LATEST "\98\05\00\00" ;; LATEST
"\cc\03\00\00" ;; @ "\cc\03\00\00" ;; @
"\f0\05\00\00" ;; TUCK "\f0\05\00\00" ;; TUCK
"\70\07\00\00" ;; NAME-LEN "\44\0e\00\00" ;; FIND-NAME-LEN
"\54\02\00\00" ;; OVER "\54\02\00\00" ;; OVER
"\fc\02\00\00" ;; = "\fc\02\00\00" ;; =
"\b4\04\00\00" ;; 0BRANCH "\b4\04\00\00" ;; 0BRANCH
@@ -1969,6 +1965,25 @@
;; => 0x50 bytes ;; => 0x50 bytes
;; : FIND-NAME-LEN 4+ C@ 63 AND ;
;; The 0x3f mask we use here includes the hidden flag, so that FIND
;; never matches a hidden entry as its length will appear to be
;; greater than the maximum length returned by WORD.
(data (i32.const 0x0e30)
"\e0\0d\00\00"
"\0dFIND-NAME-LEN\00\00"
"\00\00\00\00"
"\a8\02\00\00" ;; 4+
"\fc\03\00\00" ;; C@
"\18\04\00\00" ;; LIT
"\3f\00\00\00" ;; 63
"\8c\03\00\00" ;; AND
"\0c\04\00\00") ;; EXIT
;; => 0x30 bytes
;; The trampoline is a workaround for WebAssembly's lack of indirect ;; The trampoline is a workaround for WebAssembly's lack of indirect
;; jumps and code addresses. Instead of jumping into the next ;; jumps and code addresses. Instead of jumping into the next
;; codeword, NEXT sets the $fn global to the function index of the ;; codeword, NEXT sets the $fn global to the function index of the