Files
StarForth/src/word_source
Robert Allan JamesandClaude Sonnet 5 1a716c8048 Fix d_compare: use ucell_t instead of unsigned long (FABRIC-3.md §XII.4)
d_compare() (double_words.c), the static helper backing DMAX/DMIN/D</D=,
had the same bare-unsigned-long pattern already fixed in D+/D-/DNEGATE
(commit bea8d74) -- 32-bit unsigned long on this aarch64 target silently
truncating the low-cell comparison. Switched to ucell_t.

Verified with four cases designed specifically to expose the old
truncation: two doubles sharing the same high cell but with low cells
differing only in bits 32-63 (invisible to a 32-bit-truncated compare,
e.g. 2^32 vs 0):
  4294967296 0 0 0 D= .            -> 0  (correctly not equal)
  4294967296 0 0 0 DMIN SWAP D.    -> 0  (correctly picks the smaller)
  0 0 4294967296 0 D< .            -> -1 (correct)
  4294967296 0 0 0 D< .            -> 0  (correct)
All four pass identically on amd64, aarch64, and riscv64. These cases
were never run before this fix -- the exerciser campaign never touched
DMAX/DMIN/D</D= at all, so this is the first real evidence d_compare()
was ever exercised on any architecture. Full 24-case exerciser also
reran clean on all three architectures (no regression).

D2*/D2/ use unsigned long long (C-standard-guaranteed >=64-bit) and were
never part of this bug class. All four affected words (D+, D-, DNEGATE,
d_compare) are now fixed; M*'s separate universal DOUBLE-OVERFLOW bug
remains open (unrelated defect, out of scope here).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EXieurDfDSsDFdnSyusuWo
2026-09-11 07:44:14 -04:00
..

src/word_source/

FORTH-79 word implementations, one file per category, registered into the dictionary via include/word_registry.h. Each .c file here has a matching header in src/word_source/include/ and (for most categories) a matching test module in src/test_runner/modules/.

FORTH-79 core

  • arithmetic_words.c, mixed_arithmetic_words.c — + - * / MOD ABS MIN MAX and mixed-precision arithmetic.
  • stack_words.c — DUP DROP SWAP ROT OVER NIP TUCK.
  • control_words.c — IF ELSE THEN DO LOOP BEGIN UNTIL WHILE.
  • defining_words.c — : ; CREATE DOES> VARIABLE CONSTANT.
  • memory_words.c — @ ! C@ C! MOVE FILL.
  • return_stack_words.c — >R R> R@ RDROP 2>R 2R@ 2R>.
  • double_words.c — 2DUP 2DROP 2SWAP 2@ 2! D+ D-.
  • logical_words.c — AND OR XOR NOT INVERT LSHIFT RSHIFT.
  • io_words.c — EMIT KEY TYPE CR TAB SPACE ACCEPT.
  • string_words.c — S" SLITERAL and other string operations.
  • block_words.c — BLOCK BUFFER LOAD THRU FLUSH.
  • format_words.c — .( .R .S HEX DECIMAL BASE.
  • system_words.c — BYE ABORT INCLUDE STATE.
  • dictionary_words.c — FIND SEARCH-WORDLIST WORDS.
  • dictionary_manipulation_words.c — dictionary entry manipulation words.
  • vocabulary_words.c — VOCABULARY DEFINITIONS FORTH-WORDLIST.
  • editor_words.c — block editor words.
  • defer_words.c — DEFER/IS deferred-word mechanism, used by the Tripod message-dispatch shim (see tools/hermes_tripod_smoke.sh).

StarForth-specific extensions

  • q48_16_words.c, q48_words.c — Q48.16 fixed-point word bindings.
  • starforth_words.c — StarForth-specific extensions.
  • acl_words.c — word-level ACL system's FORTH-callable primitives (see docs/03-architecture/word-acl/).
  • lifecycle_words_hosted.c — hosted-build VM lifecycle words (birth/run primitives on the hosted side; kernel-only primitives live in src/starkernel/capsule/mama_forth_words.c).
  • log_words.c — FORTH-callable logging primitives.
  • inference_words.c — FORTH-callable bindings for the statistical inference engine (Loops #5/#6).
  • physics_benchmark_words.c — benchmark harness for the 7 physics feedback loops.
  • physics_diagnostic_words.c — physics diagnostics (WORD-ENTROPY).
  • physics_freeze_words.c — PHYSICS-FREEZE / PHYSICS-THAW.
  • physics_pipelining_diagnostic_words.c — Loop #4 pipelining diagnostics.
  • dictionary_heat_diagnostic_words.c — Loop #1 heat diagnostics.

See src/word_source/include/ for the matching headers (also includes mama_forth_words.h, whose .c implementation lives under src/starkernel/capsule/ since it's kernel-only).