Stage C-a: work law — running VM charged at each of its own beats, with carry (FABRIC-3.8 §3.13.2)

vm_physics_charge(): per-beat slope into a per-VM carry, whole units pulled
from the rest of the live fleet in proportion to heat (conservative
vm_physics_transfer), rounding shortfall kept in the carry, no fleet_window
sample. Called from vm_tick() only for the switch-current VM. Closes G9:
a VM running its own mail on its own stack now heats up while it works.

Probe (reverted): baseline Hestia heat 0->0->0 over 71 beats (FAIL, proves
G9); with charge 0->11->23 at beats 15->51->86, identical on amd64/aarch64/
riscv64, conserved, PASS. Acceptance: dict_hash unchanged, WIREBIND relay 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-23 16:51:09 -04:00
co-authored by Claude Opus 5.5
parent 29447abb7d
commit 7c3736841d
19 changed files with 64261 additions and 6 deletions
+12
View File
@@ -51,6 +51,7 @@
#include "../include/ssm_jacquard.h"
#include "vm_internal.h"
#include "starkernel/capsule_vm_physics.h"
#include "starkernel/vm/switch.h" /* sk_vm_switch_current_vm() -- FABRIC-3.8.md §3.13.2 */
#include "starkernel/timer.h"
#include <errno.h>
@@ -140,6 +141,17 @@ void vm_tick(VM* vm)
* (VM-FLEET-ATTRACTOR-DESIGN-20260705.md rev k). */
vm_physics_heartbeat_tick(vm_monotonic_ns(vm));
/* FABRIC-3.8.md §3.13.2 (Stage C-a): the work law. This beat was
* produced by `vm`'s own execution; if `vm` is the VM physically
* running (switch-current), charge it one beat. A VM whose words run
* nested inside someone else's VM-EXEC is not switch-current and is
* not charged here -- that execution is already accounted by
* vm_physics_touch()'s dispatch law. Kernel-side only: nothing a VM
* executes can ask for, skip, or give back a charge. */
if (vm == sk_vm_switch_current_vm()) {
vm_physics_charge(vm->stadium_vm_id);
}
/* Plugin 2: System State Monitoring (Future) */
/* vm_tick_system_monitor(vm); */