summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 16:16:25 -0300
committerGabriel Schneider <[email protected]>2026-10-30 20:25:56 -0300
commit05826d5148b8d75c32397380b9f64e0b3477e5bb (patch)
tree37263052ca93ebf7dc6d823631997ed7f8251dd0 /src/tape.zig
parent6cb07327b717603be983fdd6df0e6d9009aae39a (diff)
downloadpardes-05826d5148b8d75c32397380b9f64e0b3477e5bb.tar.gz
pardes-05826d5148b8d75c32397380b9f64e0b3477e5bb.zip
replica: pardes's own steps over a terminal speculated, not every input while one has the keyboard (H14): what reaches its program is a pty write and stops as before; its view (normal-mode keys, the wheel, Ctrl-u) moves here at once, the rollback copy keeping each terminal's view (it holds no emulator) and a delta setting it, put back between the units it replays in the order the deltas came among them; what was applied over a terminal applied again over each delta or rows that come while it waits, and its unit taken at once rather than kept to replay over later deltas; closing a terminal stops (its pty's end is the authority's)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tape.zig b/src/tape.zig
index 7b7c02f2..3975681e 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -219,6 +219,9 @@ pub const Tape = struct {
/// What stopped it: a host function's or a site's name, or a poison's
/// reason (PARDES_REPLICA_STATS counts them).
poisoned_by: []const u8 = "",
+ /// It read a terminal (its rows) or moved one's view: what it did
+ /// depends on the emulator, which deltas write (`touchTerminal`).
+ touched: bool = false,
/// The allocator of the core a replay makes (a replica's rollback epoch,
/// src/rollback.zig), when it is not the tape's own.
core_gpa: ?std.mem.Allocator = null,
@@ -1009,6 +1012,13 @@ pub fn poison(why: []const u8) void {
};
}
+/// A speculation read a terminal's rows or moved its view (`Tape.touched`).
+pub fn touchTerminal() void {
+ if (on) |t| if (t.speculating) {
+ t.touched = true;
+ };
+}
+
/// A harmless stand-in for what a host call or a syscall would have
/// returned to a speculation that is thrown away once it returns: an
/// error where one can be said, else zeroes.
@@ -1105,6 +1115,7 @@ pub fn beginSpeculation(t: *Tape) void {
t.speculating = true;
t.poisoned = false;
t.poisoned_by = "";
+ t.touched = false;
t.no_digest = true;
t.buf.clearRetainingCapacity();
t.seeFields();