feat(v4): HEAT-OP[0..31] and ANTICLOCK, read by HEAT-OP@ and ANTICLOCK@

#189 -- Captain Bob, 2026-11-12: "Add HEAT-OP. If it's a huge performance
hit, we'll revert it. If not ... it stands"; a full 33-cell array, as
DECOMPOSITION.md section 7 draws it; the Stadium feed is Phase 1's.

- node.h/node.c: v4_node_heat_regs_attach; a data fetch from base+k gives
  opcode k's count, base+32 the anti-clock (the low cell at 32 bits); a
  store changes nothing. Reset detaches them.
- host_map.h: HEAT_REG at word 13824, in what was free between the
  dictionary space and SEND_TEXT; the compile-time check covers it.
  Nothing moved. map-*.f18: HEAT-OP 13824, ANTICLOCK 13856.
- image.h/image.c/mkmap.c: the image carries the address; v4_image_born
  attaches the node's own counts.
- system.f18: HEAT-OP@ ( op -- n ), op mod 32; ANTICLOCK@ ( -- n ).
  word_count 318 -> 320 (hosted 317 -> 319): dict_hash changes.
- v4-dictionary.tsv: both words; DECOMPOSITION.md 7 records the build.

Also in this batch:
- Makefile: make init installs qemu-user -- hosted-check needs it
  (Captain Bob: "Add to make init now").
- .claude/memory/rules.md, rule 5: stop and ask when something comes up
  (Captain Bob: "you are supposed to stop and ask").

Tests first (logs/20261113-005047/heat-op): test_node did not compile;
test_host_quit 3 of 1337 failed. Suite: 199 programs, 7448554 checks, 0
failures; hosted-check, the three alike. Timing: no measurable cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 00:50:56 +00:00
parent 9710bd1779
commit dd6c393a89
21 changed files with 163 additions and 5 deletions
+2
View File
@@ -100,6 +100,7 @@ AGAIN ( -- ) Compile-only: end a BEGIN loop that repeats for ever.
ALIGN ( -- ) Align the dictionary pointer to the next cell.
ALLOT ( n -- ) Reserve n cells of dictionary space.
AND ( x1 x2 -- x3 ) Bitwise and.
ANTICLOCK@ ( -- n ) The anti-clock: how many instructions the node has retired, one tick each (#189).
AWAIT ( node -- how ) Wait for the node's word on how its text ended: 0 QUIT, 1 completed, otherwise an error.
BASE ( -- addr ) Variable: the number base for conversion in and out.
BEGIN ( -- ) Compile-only: mark the start of a loop (UNTIL, WHILE ... REPEAT, AGAIN).
@@ -170,6 +171,7 @@ FLUSH ( -- ) Write every changed block (SAVE-BUFFERS).
FORGET ( -- ) FORGET xxx: remove xxx and every word defined after it, never below FENCE.
FORTH ( -- ) Make FORTH, the primary vocabulary, the CONTEXT vocabulary.
GONE ( n node -- ) Tell the node that node n is gone; it acts on that only if this node is its centre.
HEAT-OP@ ( op -- n ) How many times opcode op (taken mod 32) has retired: its heat counter, HEAT-OP[op] (#189).
HERE ( -- addr ) The address of the next free dictionary cell.
HEX ( -- ) Set BASE to sixteen.
HIDDEN ( -- ) Hide the newest entry: it cannot be found until revealed.
Can't render this file because it contains an unexpected character in line 10 and column 3.
+8
View File
@@ -1090,6 +1090,14 @@ expiry, moved into logic. A packet type `SOS` is reserved for any node to emit.
Addresses are assigned in the node memory map (D-4). Names only here.
> **2026-11-12 (#189; Captain Bob: "Add HEAT-OP", a full array):** `HEAT-OP[0..31]` and `ANTICLOCK`
> are built: 33 read-only registers on the node (`v4_node_heat_regs_attach`, `v4/include/v4/node.h`),
> at word 13824 in the map the system is built with (`v4/tests/host_map.h`, `HEAT_REG`), read by
> `HEAT-OP@ ( op -- n )` and `ANTICLOCK@ ( -- n )` (`capsules/v4/sys/system.f18`). At 32-bit cells a
> read gives the low cell of the 64-bit count. `HEAT-CALL[...]`'s per-call-target table is gone from
> the engine (plan 2026-10-20, Task A1): a call's target goes to the hook at `call`, and the kernel
> keeps a word's accounts. Feeding the opcode counts to the Stadium is Phase 1's, measured.
| Register | Access | Contents |
| --- | --- | --- |
| `HEAT-OP[0..31]` | R | Per-opcode retirement heat. |