feat(v4.0.0): address faults -- an address outside memory is guarded (D-14)

Ruled 2026-10-04: guarded, an error shown, back to the prompt.

- The executor checks every address a programme uses (P, A, B) before
  using it.  Outside memory the opcode does nothing, the rest of its word
  is not executed, and P becomes the node's fault handler; a node with no
  handler stops.  v4_node_load/store never index outside memory.
- capsule/quit.v4: (FAULT), the host node's handler, prints
  "Address out of range", ends an open definition, prints ERROR and
  returns to the prompt.
- tests: every memory opcode and P in test_exec.c; from the prompt, from
  inside nested words and loops, in test_host_quit.c.

This closes the hole node.h described: a wild address used to index the
model's own memory gigabytes out of bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-04 12:04:59 -04:00
co-authored by Claude Opus 5.5
parent b5d644d498
commit b3d2d56d11
11 changed files with 277 additions and 74 deletions
+12
View File
@@ -11,6 +11,9 @@
\ ok> NOSUCH
\ UNKNOWN WORD: 'NOSUCH'
\ ERROR any line that sets NODE-ERROR ends so
\ ok> -1 @
\ Address out of range an address fault (D-14), from any depth
\ ERROR
\ The line itself is not sent back: the terminal shows what is typed.
\
\ THE RETURN STACK is circular (D-2): it has no bottom to be reset to, and
@@ -52,6 +55,15 @@ header QUIT
header ABORT
: ABORT (RESET) 1 jump (REPL)
\ ( -- ) where the node goes when a programme uses an address outside its
\ memory (D-14): the loader makes this word the node's fault handler. The
\ opcode that faulted did nothing; whatever was running is abandoned, as by
\ ABORT, and the line ends with ERROR.
: (FAULT)
$72646441 (EMIT4) $20737365 (EMIT4) $2074756F (EMIT4) \ "Address out "
$7220666F (EMIT4) $65676E61 (EMIT4) CR \ "of range"
2 jump (REPL)
\ ---- text in the source ---------------------------------------------------------
\ ." and ABORT" take the text up to the next " , which may be none at all
\ (input.v4's (PARSE)); with no closing " it is the rest of the line. Inside a definition they lay