Stage I: strip dead code -- pump drain loop, SWITCH-MARK-WORK, global interpret depth, native_switch_back_to (FABRIC-3.8 §4 row I)

Each shown dead three ways (FABRIC-3.5 §XXII): the pump loop by its
condition, by construction (birth cap == switch table capacity, every birth
registers) and at run time (probe silent through boot, G interleave, an
8-worker DoE trial and the relay); SWITCH-MARK-WORK by callers, capsules
(source and baked), experiments/tools/logs; the depth counter and back_to
field by having no readers.

Kept: Hera's own pump drain (last timer-paced delivery, Hera only) and the
always-0 readiness CSV columns (a DoE schema call). Acceptance on amd64/
aarch64/riscv64: G interleave unchanged, cfg-0 trial fail=0 2/2 dead,
relay 3, idle growth 0; dict_hash set changed by the removed word
(word_count 531) and identical across ISAs. FABRIC-3.8 stages A-I done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-24 06:23:41 -04:00
co-authored by Claude Opus 5.5
parent f152a91099
commit dd23c3aa45
18 changed files with 36834 additions and 143 deletions
+12 -43
View File
@@ -47,7 +47,6 @@
#include "starkernel/vm/bootstrap/sk_vm_bootstrap.h"
#include "starkernel/vm/kernel_hermes.h" /* FABRIC-3.6.md task 3.8 -- sk_hermes_send_one() */
#include "starkernel/vm/switch.h" /* FABRIC-3.8.md §3.13.5 -- sk_vm_idle_point() */
#include "starkernel/capsule_vm_switch_signal.h" /* §3.13.5 -- pump skips participants */
#include "starkernel/vm/stadium.h" /* task 3.8 -- stadium_conserved() evidence print */
#include "block_subsystem.h"
#include "word_source/include/keyboard_words.h"
@@ -954,48 +953,18 @@ static void sk_repl_idle(VM *active_vm)
}
g_idle_pump_active = 1;
{
/* FABRIC-3.6.md Phase 4 (Stage E), 2026-09-22: the SK_MSG_PUMP_
* BATCH cap this loop used to enforce existed to bound the cost
* of the old MSG-TICK VM-EXEC dispatch -- a genuinely expensive
* per-VM vm_interpret() call, confirmed live as a real O(N)
* bottleneck at just 9 VMs on riscv64 (see this section's own
* history above). sk_hermes_drain_checkpoint() (task 3.4) is not
* that: its own fast path is a single global-counter read
* (sk_hermes_pending_total == 0 -> return immediately,
* kernel_hermes.c's own doc comment), so walking every live VM
* every beat costs one cheap integer read per VM in the common
* case (nothing in flight), not an O(N) wall -- the cap this
* loop's own comment history worried about does not apply to
* this call. Removed: every live VM (except mama, handled
* separately below) is now visited every idle beat, matching
* what task 3.9's own testing already exercised, without the
* ceil(N/SK_MSG_PUMP_BATCH)-beat delivery latency the cap was
* accidentally imposing on kernel-Hermes drain specifically. */
uint32_t count = capsule_vm_registry_count();
uint32_t i;
for (i = 0; i < count; i++) {
VMRegistryEntry ent;
/* FABRIC-3.8.md §3.4 / §3.13.5 (Stage C-b, G3): switch
* participants are skipped -- their mail is delivered on their
* own stacks, by a switch (sk_vm_idle_point() and the trampoline),
* never drained here on Hera's. Only VMs not yet participants
* (Stage E makes every born VM one) are still pumped here. */
if (capsule_vm_registry_get_by_index(i, &ent) == 0 &&
ent.state == VM_STATE_LIVE &&
ent.vm_ptr != (void *)mama &&
!sk_vm_switch_signal_is_participant(ent.vm_id)) {
(void)sk_hermes_drain_checkpoint((VM *)ent.vm_ptr);
}
}
}
/* Hera's own kernel-Hermes queue needs draining too, same as every
* other VM's -- she is excluded from the loop above not because she
* has nothing to drain, but because she IS the pump: a self-
* targeting call here runs directly, no VM-EXEC/reentrancy concern
* (sk_hermes_drain_checkpoint() is a plain C call, not a dispatch
* into anyone else's input buffer). */
/* FABRIC-3.8.md Stage I (2026-09-24): the loop that used to drain every
* other live VM's queue here, on Hera's stack (G3), is removed. Since
* Stage E every born VM is a switch participant -- births are capped at
* stadium_max_vm_count() live VMs (capsule_birth.c), the same capacity
* as the switch-signal table, so registration cannot fail -- and a
* participant's mail is delivered on its own stack by a switch, never
* here. Shown dead three ways before removal: by the condition it
* required (a live non-participant), by that construction, and at run
* time (a probe printed nothing through a boot, the Stage G interleave,
* a full 8-worker DoE trial and the WIREBIND relay). What remains is
* Hera's own queue: she is the one VM that is never switched to for her
* mail, since she is the one running here. */
(void)sk_hermes_drain_checkpoint(mama);
g_idle_pump_active = 0;