From 77c4a6e346e08538abc410f85a86bec7e8dbedb3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 29 Oct 2026 22:01:29 -0300 Subject: screen-state replicas: a replica's emulators on the C heap, outside its rollback epoch, so a delta written under a held copy is no copy's to keep or put back (a ReleaseFast run found the heap corrupted) terminal.zig: State.gpa, what an emulator and its State are allocated with: the core's, but on a screen-state replica the C heap (emulator_gpa). replica.zig applies deltas and rows with it; the epoch's pause is gone (rollback.zig back to part A's but for the rows cache). The harness in ReleaseFast corrupted the heap after 20 seeds: a safe build's check named an allocation the copy saved and a delta freed while the epoch was paused, reached as `Text.own` through a view's stale slot (views.zig keeps the live view's parked share as stale copies, and the copy walks it), the replica's old terminal's pin map at that address. With the emulator outside the epoch, nothing of it is saved, kept or put back, and every free under a held copy is put off again, as in part A. Debug, 20 seeds at 80 ms and the defaults: no divergence, every replica and terminal the authority's. Co-Authored-By: Claude Opus 5.5 --- src/rollback.zig | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/rollback.zig') diff --git a/src/rollback.zig b/src/rollback.zig index d87671e6..79b8202e 100644 --- a/src/rollback.zig +++ b/src/rollback.zig @@ -140,18 +140,6 @@ pub const Epoch = struct { _ = e.live.remove(addr); } - /// What is allocated and freed until `unpause` is no copy's: a delta - /// written into a replica's terminal while a copy is held (an emulator - /// is the authority's, outside every copy, and must outlive a rollback). - pub fn pause(e: *Epoch) bool { - defer e.on = false; - return e.on; - } - - pub fn unpause(e: *Epoch, was: bool) void { - e.on = was; - } - fn begin(e: *Epoch) void { std.debug.assert(!e.on); e.id +%= 1; -- cgit v1.3