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
+1
View File
@@ -48,6 +48,7 @@ typedef struct {
v4_cell console_tx, console_rx, console_status;
v4_cell dstack_reg, rstack_reg;
v4_cell node_error;
v4_cell heat_reg; /* HEAT-OP[0]; ANTICLOCK is 32 after it (node.h, #189) */
/* the dictionary's two variables: DP holds HERE, a byte address, and
* LATEST the newest word of FORTH. What lies below HERE, and LATEST,
+20
View File
@@ -167,8 +167,16 @@ typedef struct {
/* NODE-ERROR as a trap (D-18). See v4_node_error_attach. */
v4_cell error_reg; /* its word address, or -1 */
/* HEAT-OP[0..31] and ANTICLOCK (section 7). See v4_node_heat_regs_attach. */
v4_cell heat_reg; /* the word address of HEAT-OP[0], or -1 */
const v4_uheat_t *heat_op; /* the 32 per-opcode counts (heat.h) */
const v4_uheat_t *heat_anticlock;
} v4_node;
/* How many cells the heat registers take: HEAT-OP[0..31], then ANTICLOCK. */
#define V4_HEAT_REGS 33u
/* Zero P, A and B, empty the stacks, and clear memory. Installs every
* boundary (memory and both stacks) and leaves the node in a defined state. */
void v4_node_reset(v4_node *n);
@@ -427,6 +435,18 @@ void v4_node_fault(v4_node *n, unsigned kind, v4_cell addr);
* detaches both (-1); the addresses are the caller's choice (D-4). */
void v4_node_stack_regs_attach(v4_node *n, v4_cell d, v4_cell r);
/* HEAT-OP[0..31] and ANTICLOCK, the heat registers (DECOMPOSITION.md section 7; Captain Bob,
* 2026-11-12: "Add HEAT-OP", a full array; #189).
*
* After v4_node_heat_regs_attach(n, base, op, anticlock):
* a data fetch from base + k, k = 0 .. 31, gives op[k], opcode k's retirement count
* (v4_heat.op, heat.h), and from base + 32 *anticlock -- each as a cell: its low cell at
* 32-bit cells, where the counts are 64-bit;
* a store to any of them changes nothing: they are read-only (R), and not memory.
* The counts are read as they are at the fetch. v4_node_reset detaches them (-1); the address is
* the caller's choice (D-4). */
void v4_node_heat_regs_attach(v4_node *n, v4_cell base, const v4_uheat_t *op, const v4_uheat_t *anticlock);
/* A BLOCK (DECOMPOSITION.md D-19, 5.11). Mass storage is the kernel's: a
* node asks it for a block by a request on port 0 (docs/v4.0.0/MESH.md
* section 8; blocks.h), and has nothing of it but these. A block is 1024 bytes, and a byte