test(v4.0.0): execute UM/MOD on the golden model; measure stack headroom

UM/MOD is assembled exactly as DECOMPOSITION.md section 4 gives it and
needs no change: it is exact for every uhi < ud at 32- and 64-bit cells.
It is checked against q*d + r = uhi:ulo with r < d through v4_umul, so
no second C divider has to be trusted. Coverage: all edge-vector triples
with uhi < ud plus 20000 pseudo-random cases (top-bit, small and
near-maximum divisors), optimised and under ASan+UBSan. Two hand
mutations each fail more than 15000 checks.

New headroom probe: runs a word with marked cells under the canary and
under its return address and reports how many survive, since the D-2
circular stacks overwrite silently instead of faulting. Measured:
  UM*     6 data cells under its args, 4 return entries under its return
  UM/MOD  3 data cells under its args, 3 return entries under its return

DECOMPOSITION.md: UM/MOD marked executed, with its defined range and
stack limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-02 19:48:04 -04:00
co-authored by Claude Opus 5.5
parent 9a391eb0ad
commit 41f59afeb3
2 changed files with 165 additions and 3 deletions
+6
View File
@@ -232,6 +232,12 @@ dependency order.
IF a - SWAP 1 OR SWAP THEN
NEXT
SWAP ;
\ Executed on the golden model unchanged (2026-10-02): exact, q*d + r = uhi:ulo
\ with r < d, for every uhi < ud at 32- and 64-bit cells. Outside that range
\ (uhi >= ud, including ud = 0) the result is unspecified, as in FORTH-79; it
\ always terminates after 32 steps. Stack use (D-2): at most 3 data cells may
\ lie under the three arguments and at most 3 return-stack entries under its
\ return address. For UM* the same limits are 6 and 4.
\ ---- signed division, truncating toward zero (v3 semantics) -------------
: SM/REM ( d n -- rem quot )