fix(v4.0.0): 29 values left on the stack hung the node; and what the review of step 6d found

The review of step 6d found it not sound.  Mended here, with a check
that failed first: a text that left 29 values on the stack hung the
node for ever, on the products too -- the passes over the messages
waiting that follow every text need four cells, and a stack fault in the
middle of one left the messages in pieces.  Such a text ends 'Stack
overflow', as before step 6d.  hosted-check types it.

The other findings are open and are written under step 6d in MESH.md
section 10; the README no longer says the aim is met.

make -C v4 test and sanitize at both widths, hosted-check.  The bare
metal boots have not been made again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-08 01:59:28 -04:00
co-authored by Claude Opus 5.5
parent 2b587206ee
commit 380f1cc6ec
6 changed files with 59 additions and 3 deletions
+7
View File
@@ -54,6 +54,11 @@ macro R-CLEAR RSTACK-DEPTH b! a !b endmacro
\ stops compiling first; it is always jumped to, never called, by
\ something that has emptied the return stack (or by a fault, which empties
\ it). (LINE-STATUS) keeps how the last text ended.
\ A TEXT MAY LEAVE 28 VALUES ON THE STACK. What a node does between texts
\ -- (IDLE)'s passes over the messages waiting -- needs four cells of it,
\ and a stack fault in the middle of a pass would leave those messages in
\ pieces. So a text that leaves more ends here in "Stack overflow", with
\ the stack emptied, as a fault would end it.
\ THE MESSAGE SAYING HOW IT ENDED is not written here: whoever sent the
\ text may be stuck, and this node would wait on it. It is put with the
\ messages waiting and passed on from (IDLE), as any message for another
@@ -61,6 +66,7 @@ macro R-CLEAR RSTACK-DEPTH b! a !b endmacro
\ another text from the same sender until it has gone ((MINE?)): so what
\ one sender is told comes in the order the texts were done.
: (FINISH) ( s -- )
DSTACK-DEPTH a! @ -30 + -if OVER drop \ what follows needs four cells of the stack: with
1 (QUIET) a! ! \ from here an error is not this text's: see (RAISED)
(LINE-STATUS) b! dup !b
(FLUSH-OUT)
@@ -73,6 +79,7 @@ macro R-CLEAR RSTACK-DEPTH b! a !b endmacro
(MQ!) \ how it ended
pop if FRONT -1 + FOR (MQ@) (MQ!) NEXT jump (IDLE) \ and those go round behind it: it is the oldest
FRONT: drop jump (IDLE)
OVER: drop 0 DSTACK-DEPTH a! ! jump (D-OVER) \ more left on it than may wait, the text ends in that error
FULL: drop \ no room at all: it is offered here, and the node waits
(MSG)+1 a! @ (DONE-PORT) a! @ (GATE)
3 (HDR) 4 !b !b