docs(v4): heat.c's and the stacks' comments say what the code does (#181)
- heat.c call_index(): the comment read as an unfinished thought ("hash-mod or
just take low bits?", "ignore for now? Or clamp?"). It now states the rule
the code follows: indexed by the target, a target past the table not counted,
-1 telling the callers so; the table D-6's stand-in, which ENGINE step 4
Part A1 plans to remove.
- stack.h points 1 and 2 said there was no overflow detection "and there never
will be" and that a depth exceeded corrupted silently -- D-2, which D-16
revised. Now: guarded before every opcode, a mesh node 10 and 9, the host node
32 and 32 (D-17); C code that serves a node checks the depth itself.
- stack.c named an 8-ring and depths 10 and 9 only, and said D-2's rule still
held.
- DATASHEET-F18.md section 13 item 4 (this gap) struck, resolved in place.
Comments only: test_stack and test_heat unchanged at both widths (730,137 and
8,272 checks, 0 failures).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+14
-10
@@ -17,17 +17,21 @@
|
||||
*
|
||||
* Two consequences that the ISA and the capsule code must both respect:
|
||||
*
|
||||
* 1. There is no overflow or underflow detection, and there never will be.
|
||||
* Pushing past the bottom silently overwrites the oldest entry. This is
|
||||
* hardware behaviour, reproduced faithfully here rather than defended
|
||||
* against: a golden model that trapped on overflow would diverge from
|
||||
* the thing it is a model of, which is the whole point of the exercise.
|
||||
* 1. A running programme cannot overflow or underflow a stack: before every
|
||||
* opcode the executor checks that the stacks hold what it takes and have
|
||||
* room for what it leaves, and faults instead (D-16, exec.h). The ring
|
||||
* below still wraps -- that is what push and pop do when C code calls
|
||||
* them at either end, and why C code that serves a node checks the depth
|
||||
* first (manage.c, blocks.c) -- but no opcode reaches the wrap.
|
||||
*
|
||||
* 2. Nesting is therefore shallow (10 and 9), and exceeding either depth
|
||||
* corrupts silently rather than faulting. DECOMPOSITION.md section 3
|
||||
* calls this out as the constraint that "every CAP definition in section
|
||||
* 4 and 5 must be re-checked against ... before it is accepted as a POST
|
||||
* target; the hand traces so far assumed unbounded stacks."
|
||||
* 2. Nesting is shallow: a mesh node's stacks are the F18's 10 and 9; the
|
||||
* host node's are 32 and 32 (D-17: V4_DATA_RING and V4_RET_RING, set in
|
||||
* v4/Makefile). One value or one call past either depth is a stack fault
|
||||
* with its message, where under D-2 it corrupted silently.
|
||||
*
|
||||
* (Points 1 and 2 corrected 2026-11-12, #181: they said there was no overflow
|
||||
* detection "and there never will be", and that exceeding a depth corrupted
|
||||
* silently -- D-2's rule, which D-16 revised.)
|
||||
*
|
||||
* The T/S + 8-ring decomposition is the hardware shape, not an optimisation:
|
||||
* T and S are architectural registers (section 1.1 lists them), and the ring
|
||||
|
||||
Reference in New Issue
Block a user