diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 02:02:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 02:32:57 -0300 |
| commit | c77e5a09af27976b2375a902ecb8efa428395a0c (patch) | |
| tree | cb36b7b3c691b4904d2a1c2a182cd747e7c82602 /core | |
| parent | 866e9ed6762f42a32907d63d783464f2c90d5b85 (diff) | |
| download | pardes-c77e5a09af27976b2375a902ecb8efa428395a0c.tar.gz pardes-c77e5a09af27976b2375a902ecb8efa428395a0c.zip | |
tape: the wrappers deleted, step 6c (reports/pardes-handle-69-design.md): a core's host is always its own (a replica's none), the tape only says which functions it has when the core holds another than the last said (noteHost, today's comparison, so a mask lands where it did) and a replica answers by that word (the bool replica, set by its first replay or its join; Tape.has), so Wrap's arity table, hostOf, wrap, the tape's vtable, resync's and Peers.stop's unwrap and apply's three hostOf go; the 9 presence questions are p.tape.has(p, .search); keeps_stopping and forTheView are lists of the table's names, a renamed field no longer compiling there; root.zig's machine scan names host.vtable and host.ctx, which only tape.zig's noteHost line names now (40 lines of core/ named the table at the base); the tape's bytes do not move (semantics 32640d4a722b811c unmoved, cross_replay both ways)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
| -rw-r--r-- | core/Core.zig | 6 | ||||
| -rw-r--r-- | core/Effect.zig | 2 | ||||
| -rw-r--r-- | core/File.zig | 2 | ||||
| -rw-r--r-- | core/Stream.zig | 8 | ||||
| -rw-r--r-- | core/exec.zig | 2 | ||||
| -rw-r--r-- | core/replica.zig | 1 | ||||
| -rw-r--r-- | core/root.zig | 15 | ||||
| -rw-r--r-- | core/tape.zig | 164 |
8 files changed, 77 insertions, 123 deletions
diff --git a/core/Core.zig b/core/Core.zig index 3fc5b192..64eb7b02 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -1466,11 +1466,11 @@ pub fn animationActive(p: *const Pardes) bool { } pub fn pump(p: *Pardes, host: Host) !void { - // By hand, not `taped`: the host is set before the enter, which says it if it is another, and is no input. + // By hand, not `taped`: the host is set before the enter, which says which functions it has if it is another, and is no input. p.host = host; const taped = pardes.tape.enter(p, .pump); defer pardes.tape.leave(p, taped); - if (p.host.has(.wait_input)) { + if (p.tape.has(p, .wait_input)) { // Asleep until input or until the core's next deadline // (nextWake); 0 is no timeout at all. // The clock read whether or not it is wanted: what a replica @@ -1499,7 +1499,7 @@ pub fn pump(p: *Pardes, host: Host) !void { // rendering and nothing else. // A shell with a clock draws what `advance` stepped; one without // steps its own `.tick`s and draws while a deadline is due. - if (!p.needs_frame and (p.host.has(.now) or !p.animationActive())) return p.frames.idle(); + if (!p.needs_frame and (p.tape.has(p, .now) or !p.animationActive())) return p.frames.idle(); // No one to see it: the frame stays owed (needs_frame), not drawn. // A pty streaming into an unwatched session spent most of its time // drawing what nobody looked at. diff --git a/core/Effect.zig b/core/Effect.zig index a6fcc0e5..cabfe8ea 100644 --- a/core/Effect.zig +++ b/core/Effect.zig @@ -213,7 +213,7 @@ fn performInner(p: *Pardes, e: Effect) void { // No workers here (a test, a board): it runs on the loop. .search => |q| p.tape.host(p, .search, .{q.gen}) orelse Stream.runHere(p, q.gen, false), // No windows here (a test, the tty): it stays. - .hand_over => |h| if (p.host.has(.hand_over)) { + .hand_over => |h| if (p.tape.has(p, .hand_over)) { if (p.handover.bytes) |bytes| _ = p.tape.host(p, .hand_over, .{ h.seq, bytes }); } else p.update(.{ .handed = .{ .seq = h.seq, .failure = "no other windows here" } }), .edit_write => { diff --git a/core/File.zig b/core/File.zig index 75d8049b..325abee9 100644 --- a/core/File.zig +++ b/core/File.zig @@ -1579,7 +1579,7 @@ pub fn refreshHighlights(p: *Pardes) void { // itself on the frame, a third of the work; the stretch around it // comes painted ahead (paintAhead) where there are workers. const far = f.highlights.len == 0 or need_end <= f.highlight_start or need_start >= f.highlight_start + f.highlights.len; - const slack: usize = if (far and p.host.vtable.search != null) 0 else if (f.highlights.len == 0) 0 else pane.rows; + const slack: usize = if (far and p.tape.has(p, .search)) 0 else if (f.highlights.len == 0) 0 else pane.rows; const whole = pane.colorAlgo() == .locations or f.tree_context; // Painted ahead on a worker (Stream.paintAhead): taken, no parse. if (!whole and pane.colorAlgo() == .source) if (Stream.takeAhead(p, pane.serial, f.revision, need_start, need_end)) |got| { diff --git a/core/Stream.zig b/core/Stream.zig index dae61a8b..6f99b504 100644 --- a/core/Stream.zig +++ b/core/Stream.zig @@ -311,7 +311,7 @@ pub fn takeAhead(p: *Pardes, serial: u32, revision: u32, need_start: usize, need /// workers, and only for a grammar a worker can paint (syntax.readyApart). pub fn paintAhead(p: *Pardes, serial: u32, revision: u32, path: []const u8, content: []const u8, from: usize, to: usize) void { const s = &p.stream; - if (p.host.vtable.search == null or p.fs.serving or to <= from or to > content.len) return; + if (!p.tape.has(p, .search) or p.fs.serving or to <= from or to > content.len) return; const a = s.ahead_for; if (s.ahead.len != 0 and a.serial == serial and a.revision == revision and from >= a.start and to <= a.start + s.ahead.len) return; // A stretch bigger than this (a few lines of a minified file) is not @@ -355,7 +355,7 @@ pub fn askAhead(p: *Pardes) void { /// one revision of a file. pub fn paintRows(p: *Pardes, path: []const u8) void { const s = &p.stream; - if (s.rows_paint != null or p.host.vtable.search == null) return; + if (s.rows_paint != null or !p.tape.has(p, .search)) return; // Asked while a 9P write is served (a script's Grep): not now, as no // paint is (the write would wait for it to settle); the next step asks. if (p.fs.serving) { @@ -452,7 +452,7 @@ pub fn parseFor(p: *Pardes, id: usize) void { s.parse_next = .{ .serial = pane.serial, .revision = f.revision }; return; } - const workers = p.host.vtable.search != null and !p.fs.serving; + const workers = p.tape.has(p, .search) and !p.fs.serving; if (!workers and f.content.len > 64 << 10) return; const job = TextJob.make(p.gpa, pane.serial, f.revision, 0, f.path, f.content) orelse return; s.gen +%= 1; @@ -559,7 +559,7 @@ pub fn step(p: *Pardes) void { s.state = .searching; // A script's write (whose answer says whether it found anything) and a // host with no workers: done before this returns. - if (p.host.vtable.search != null and !p.fs.serving) p.emit(.{ .search = .{ .gen = s.gen } }) else runHere(p, s.gen, false); + if (p.tape.has(p, .search) and !p.fs.serving) p.emit(.{ .search = .{ .gen = s.gen } }) else runHere(p, s.gen, false); } /// When the core next needs a tick for the stream: the end of the pause. diff --git a/core/exec.zig b/core/exec.zig index 197827bb..36879b70 100644 --- a/core/exec.zig +++ b/core/exec.zig @@ -418,7 +418,7 @@ fn refusedPlacement(p: *Pardes, id: usize) bool { /// Whether a shell would be started in `dir` and `dir` is not there: asked /// only of a host that starts shells, and only of a local path. pub fn missingDir(p: *Pardes, dir: []const u8) bool { - if (p.host.vtable.spawn == null) return false; + if (!p.tape.has(p, .spawn)) return false; // A peer's directory (`/n/peer/x`) is no directory on this host, where // the shell would start: no command or terminal runs there, and none // is made to say `exit 127`. diff --git a/core/replica.zig b/core/replica.zig index 3aeb21af..559ae8f5 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -2426,7 +2426,6 @@ pub const Peers = struct { if (!ps.recording) return; pardes.panes.resizeDeferred(core); ps.screens.deinit(core); - if (core.host.vtable == &ps.t.vtable) core.host = ps.t.real; tape.on = null; core.tape = core.opts.tape orelse &tape.none; tape.release(&ps.t); diff --git a/core/root.zig b/core/root.zig index 632385a0..5130cde8 100644 --- a/core/root.zig +++ b/core/root.zig @@ -599,10 +599,13 @@ test "nothing of a core is a process global: every container-level var in core/ /// The lines of each file of core/ that name the machine outside a test: /// `std.c.`, `libc.`, `std.posix.`, `getenv`, std.Io's File, Dir, net and -/// Threaded (a path's text, `Dir.path`, and `max_path_bytes` are none), and -/// `@import("dev")` and `@import("runtime")`, by file, how many and why. A -/// step's read of its own machine with no tape diverges a far client, and -/// the soak (one machine) never sees it: a new line here makes someone look. +/// Threaded (a path's text, `Dir.path`, and `max_path_bytes` are none), +/// `@import("dev")` and `@import("runtime")`, and the host's table +/// (`host.vtable`, `host.ctx`: only the tape's own lines call the host, a +/// call made past it is no call a replica replays), by file, how many and +/// why. A step's read of its own machine with no tape diverges a far +/// client, and the soak (one machine) never sees it: a new line here makes +/// someone look. /// The count is a file's, so it cannot tell a step's read from its host /// half's; the reason says which the file's are. const machine_lines = [_]struct { []const u8, usize, []const u8 }{ @@ -632,7 +635,7 @@ const machine_lines = [_]struct { []const u8, usize, []const u8 }{ .{ "rollback.zig", 1, "a test helper's directory" }, .{ "root.zig", 4, "dev's modules re-exported (host_io, file_watch, glide, fonts)" }, .{ "selection_pipe.zig", 14, "a pipe's child processes and their files: the host's `pipe` entry" }, - .{ "tape.zig", 11, "the tape's own files and host_io's types: a recording, a replay; the `io` a tape hands a site's body" }, + .{ "tape.zig", 12, "the tape's own files and host_io's types: a recording, a replay; the `io` a tape hands a site's body; which host the core holds (noteHost), the one file that names the host's table" }, .{ "lsp/lsp.zig", 1, "the language server's client (dev): the host's `lsp` entry" }, .{ "ninep/ctl.zig", 1, "the session's pid in a 9P read: the session's server" }, .{ "ninep/events.zig", 2, "the 9P event log's clock: the session's server" }, @@ -644,7 +647,7 @@ const machine_lines = [_]struct { []const u8, usize, []const u8 }{ /// The lines of `src` that name the machine (`machine_lines`'s rules). fn machineLines(src: []const u8, gpa: std.mem.Allocator, out: *std.ArrayList(usize)) !void { - const names = [_][]const u8{ "std.c.", "libc.", "std.posix.", "getenv", "std.Io.File", "std.Io.Dir", "std.Io.net", "std.Io.Threaded", "Io.File", "Io.Dir", "Io.net", "Io.Threaded" }; + const names = [_][]const u8{ "std.c.", "libc.", "std.posix.", "getenv", "std.Io.File", "std.Io.Dir", "std.Io.net", "std.Io.Threaded", "Io.File", "Io.Dir", "Io.net", "Io.Threaded", "host.vtable", "host.ctx" }; const pure = [_][]const u8{ "std.Io.Dir.path.", "Io.Dir.path.", "std.Io.Dir.max_path_bytes", "Io.Dir.max_path_bytes" }; var open: std.ArrayList(u8) = .empty; defer open.deinit(gpa); diff --git a/core/tape.zig b/core/tape.zig index 18b5e296..80a14079 100644 --- a/core/tape.zig +++ b/core/tape.zig @@ -239,18 +239,24 @@ pub const Tape = struct { /// call out of it is the host's to answer. host_side: bool = true, depth: u32 = 0, - vtable: VTable = .{}, // Recording. fd: c_int = -1, buf: std.ArrayList(u8) = .empty, scratch: std.Io.Writer.Allocating, - real: pardes.Host = .{}, + /// The host whose functions were last said (`noteHost`). + real: Host = .{}, seen: [watched.len]u64 = @splat(0), // Replaying. in: walk.Reader = .{ .bytes = &.{} }, arena: std.heap.ArenaAllocator, last_ret: walk.Reader = .{ .bytes = &.{} }, + /// Which functions the session's host has, a bit each in the table's + /// order (`Host.mask`): what a replica's core answers by (`has`). mask: u64 = 0, + /// A replica's (a client's, a replay's), from its first replay or its + /// join (`replayUnit`, `adoptCore`): its core has no host, and asks + /// the tape what the session's has, between its steps too (a frame). + replica: bool = false, skips_render: bool = false, digests: u64 = 0, diverged: ?[]const u8 = null, @@ -378,35 +384,17 @@ pub const Tape = struct { inline for (watched, 0..) |name, i| t.seen[i] = walk.digest(Watched(name), watchedOf(p, name)); } - /// The host's functions go through the tape while it records, whoever - /// set `p.host` last. - fn wrap(t: *Tape, p: *Pardes) void { - if (p.host.vtable == &t.vtable) return; - // The same host given again (each pump is given its host): only - // the wrapper put back. - if (p.host.vtable == t.real.vtable and p.host.ctx == t.real.ctx) { - p.host = .{ .ctx = t, .vtable = &t.vtable }; - return; - } + /// Which functions the session's host has, said at an entry whose + /// core holds another host than the last said (each pump is given its + /// host again: then nothing). + fn noteHost(t: *Tape, p: *const Pardes) void { + if (p.host.vtable == t.real.vtable and p.host.ctx == t.real.ctx) return; t.real = p.host; - const mask = p.host.mask(); - p.host = t.hostOf(mask); - const set: struct { u8, u64 } = .{ set_mask, mask }; + t.mask = p.host.mask(); + const set: struct { u8, u64 } = .{ set_mask, t.mask }; t.record(.set, @TypeOf(set), &set); } - /// The tape as a host with these functions. - fn hostOf(t: *Tape, mask: u64) pardes.Host { - t.mask = mask; - t.vtable = .{}; - inline for (host_fns, 0..) |f, i| if (mask & (@as(u64, 1) << i) != 0 or - (t.skips_render and comptime std.mem.eql(u8, f, "watched"))) - { - @field(t.vtable, f) = &Wrap(i).f; - }; - return .{ .ctx = t, .vtable = &t.vtable }; - } - fn enterInput(t: *Tape, p: ?*Pardes, input: *const Input) Entered { if (!t.host_side) return .{}; t.host_side = false; @@ -415,7 +403,7 @@ pub const Tape = struct { if (p) |core| { if (t.core == null) t.core = core; t.noteWrites(); - t.wrap(core); + t.noteHost(core); } // A terminal's output crosses as screen state, not as its bytes. if (t.screen_state and input.* == .update and input.update.args[0] == .output) { @@ -432,7 +420,7 @@ pub const Tape = struct { if (t.replay) return; if (p) |core| if (t.core == null) { t.core = core; - t.wrap(core); + t.noteHost(core); }; t.record(.done, void, &{}); if ((t.depth == 0 or t.every) and !t.no_digest and !t.unit_digests) recordDigest(t); @@ -639,8 +627,7 @@ pub const Tape = struct { fn applySet(t: *Tape, r: *walk.Reader) void { const which = (r.take(1) catch return)[0]; if (which == set_mask) { - const h = t.hostOf(std.mem.bytesToValue(u64, r.take(8) catch return)); - if (t.core) |p| p.host = h; + t.mask = std.mem.bytesToValue(u64, r.take(8) catch return); return; } const p = t.core orelse return; @@ -683,7 +670,6 @@ pub const Tape = struct { .init_from_dump => |d| pardes.dump.initFromDump(gpa, opts, d.bytes), else => unreachable, } catch |err| return t.diverge("init failed: {t}", .{err}); - t.core.?.host = t.hostOf(t.mask); return t.finishInput(); }, else => {}, @@ -695,7 +681,6 @@ pub const Tape = struct { const nc = pardes.dump.restore(p, a.args[0], a.args[1]) catch |err| return t.diverge("restore failed: {t}", .{err}); t.core = nc; nc.tape = t; - nc.host = t.hostOf(t.mask); }, // The session is over (or the core a Restore replaced is // freed): nothing done now is compared. @@ -706,7 +691,7 @@ pub const Tape = struct { } return t.skip(); }, - .pump => p.pump(t.hostOf(t.mask)) catch {}, + .pump => p.pump(.{}) catch {}, .render => if (t.skips_render) return t.skip() else { _ = p.frame_arena.reset(.retain_capacity); _ = p.render(p.frame_arena.allocator()) catch {}; @@ -838,12 +823,19 @@ pub const Tape = struct { /// to a speculation, or recorded as made (`keeps_stopping`). Null: the /// session's host has no such function. pub inline fn host(t: *Tape, p: *const Pardes, comptime f: Host.Fn, args: Host.Args(f)) ?Host.Ret(f) { - // Nobody records: the call it always was. (Until the wrappers go, - // a core's host is this tape's table while it records or replays, - // and any other is called as it is.) - if (t.through or p.host.vtable != &t.vtable) return p.host.call(f, args); - if (!p.host.has(f)) return null; - return hostCall(t, f, args); + // Nobody records: the call it always was. + if (t.through) return p.host.call(f, args); + if (!t.has(p, f)) return null; + return hostCall(t, p, f, args); + } + + /// Whether the session's host has `f`, asked apart from a call: a + /// replica's core has no host, and answers as its session's did. + pub fn has(t: *const Tape, p: *const Pardes, comptime f: Host.Fn) bool { + if (!t.replica) return p.host.has(f); + // A replica that never draws asks, and is told no one watches (`hostCall`). + if (comptime f == .watched) if (t.skips_render) return true; + return t.mask & (@as(u64, 1) << @backingInt(f)) != 0; } /// Asked by `turn.yield`: a syscall a replica must never make. @@ -916,7 +908,7 @@ pub const Tape = struct { p.tape = t; if (t.replay or t.through) return; t.core = p; - t.wrap(p); + t.noteHost(p); } /// Whether `p` is the core being recorded (a Restore's old one is not). @@ -1132,95 +1124,58 @@ fn tagOf(comptime entry: anytype, comptime Made: type) [:0]const u8 { return found orelse @compileError("tape: no variant of Input names the entry " ++ @typeName(Made) ++ " (a line `<tag>: Args(<the entry>)` in tape.Input)"); } -/// The Host function `i`, through the tape. -fn Wrap(comptime i: usize) type { - const h = @field(Host.Fn, host_fns[i]); - const R = Host.Ret(h); - const P = @typeInfo(@typeInfo(@FieldType(VTable, host_fns[i])).optional.child).pointer.child; - const A = @typeInfo(P).@"fn".param_types; - return switch (A.len) { - 1 => struct { - fn f(ctx: ?*anyopaque) R { - return hostCall(@ptrCast(@alignCast(ctx.?)), h, .{}); - } - }, - 2 => struct { - fn f(ctx: ?*anyopaque, a: A[1].?) R { - return hostCall(@ptrCast(@alignCast(ctx.?)), h, .{a}); - } - }, - 3 => struct { - fn f(ctx: ?*anyopaque, a: A[1].?, b: A[2].?) R { - return hostCall(@ptrCast(@alignCast(ctx.?)), h, .{ a, b }); - } - }, - 4 => struct { - fn f(ctx: ?*anyopaque, a: A[1].?, b: A[2].?, c: A[3].?) R { - return hostCall(@ptrCast(@alignCast(ctx.?)), h, .{ a, b, c }); - } - }, - 5 => struct { - fn f(ctx: ?*anyopaque, a: A[1].?, b: A[2].?, c: A[3].?, d: A[4].?) R { - return hostCall(@ptrCast(@alignCast(ctx.?)), h, .{ a, b, c, d }); - } - }, - else => @compileError("tape: a host function of more arguments"), - }; -} - /// The Host entries that return nothing and still stop a speculation, each /// with why; a speculation records any other as made and goes on (`hostCall`). /// The entries that answer stop by nature: the answer is the session's. -const keeps_stopping = .{ +const keeps_stopping = [_]Host.Fn{ // A shell's input: a device by the user's line (a far shell may feel // like ssh), and off the tape with screen-state terminals. - "pty_write", + .pty_write, // Its host says into the core on every call that the shell started // and where (host_io.forkShell: acknowledgeShell, setCwd), and gives // the turn away: a rollback every time, nothing gained. - "spawn", + .spawn, // Its host writes the core outside any record (exec.reapplyInitFile, // Plumb.saved, fs.writeSelf) besides `saved` or the failure, every call. - "write_file", + .write_file, // Their hosts say done or failed into the core on every call // (setLastDump, dumpFailed; setMessage, reportError): a rollback every // time, nothing gained. - "write_dump", - "dump_themes", + .write_dump, + .dump_themes, // The session's own: it execs itself after the step, carries a window // away, or lets its frontend go (writing `frontend` and `unattended`). - "upgrade", - "hand_over", - "detach", + .upgrade, + .hand_over, + .detach, // The loop's, never a step's. - "wait_input", - "present", - "post_present", - "poll_frame", + .wait_input, + .present, + .post_present, + .poll_frame, }; -fn keepsStopping(comptime name: []const u8, args: anytype) bool { +fn keepsStopping(comptime f: Host.Fn, args: Host.Args(f)) bool { // Turned on, its host loads the theme file into the core outside any // record (colors.loadThemeFile: custom_theme, theme_file_loaded); // turned off it only lets the file go. - if (comptime std.mem.eql(u8, name, "watch_theme")) return args[1]; - inline for (keeps_stopping) |s| if (comptime std.mem.eql(u8, s, name)) return true; - return false; + if (comptime f == .watch_theme) return args[1]; + return comptime std.mem.indexOfScalar(Host.Fn, &keeps_stopping, f) != null; } /// The entries a view's frontend makes on its own machine (P16). -fn forTheView(comptime name: []const u8) bool { - return std.mem.eql(u8, name, "set_clipboard") or std.mem.eql(u8, name, "read_clipboard") or std.mem.eql(u8, name, "open_link"); +fn forTheView(comptime f: Host.Fn) bool { + return f == .set_clipboard or f == .read_clipboard or f == .open_link; } /// The one body of a call out to the host through the tape (`Tape.host`). -fn hostCall(t: *Tape, comptime f: Host.Fn, args: Host.Args(f)) Host.Ret(f) { +fn hostCall(t: *Tape, p: *const Pardes, comptime f: Host.Fn, args: Host.Args(f)) Host.Ret(f) { const R = Host.Ret(f); const name = @tagName(f); // A terminal's answers and what is typed at it from its output are the // authority's to write, never a replica's: off the tape on both sides. if (comptime std.mem.eql(u8, name, "pty_write")) if (t.screen_state and !t.speculating) { - if (!t.replay) @call(.auto, @field(t.real.vtable.*, name).?, .{t.real.ctx} ++ args); + if (!t.replay) _ = p.host.call(f, args); return; }; if (t.replay) { @@ -1253,7 +1208,7 @@ fn hostCall(t: *Tape, comptime f: Host.Fn, args: Host.Args(f)) Host.Ret(f) { // on. The session's unit records the same, or more where its host // wrote the core during the call (an input it made, a watched field // set), and the client rolls back. - if (R == void and !keepsStopping(name, args)) { + if (R == void and !keepsStopping(f, args)) { t.record(.host, u16, &id); t.record(.ret, void, &{}); return; @@ -1265,17 +1220,16 @@ fn hostCall(t: *Tape, comptime f: Host.Fn, args: Host.Args(f)) Host.Ret(f) { // A client's yank, paste or link is its own frontend's, made on its own // machine from its view's record (Pardes.View.yanks): never the // session's, whose host makes them for a view no client draws. - if (comptime forTheView(name)) if (t.core) |p| if (p.undrawn & (@as(u8, 1) << @intCast(p.live)) != 0) { + if (comptime forTheView(f)) if (p.undrawn & (@as(u8, 1) << @intCast(p.live)) != 0) { t.record(.host, u16, &id); t.record(.ret, void, &{}); return; }; - const real = @field(t.real.vtable.*, name).?; t.record(.host, u16, &id); t.seeFields(); const outer = !t.host_side; t.host_side = true; - const r = @call(.auto, real, .{t.real.ctx} ++ args); + const r = p.host.call(f, args).?; t.host_side = !outer; t.noteWrites(); t.record(.ret, R, &r); @@ -1336,7 +1290,7 @@ pub fn recordDigest(t: *Tape) void { pub fn adoptCore(t: *Tape, p: *Pardes) void { t.core = p; p.tape = t; - p.host = t.hostOf(t.mask); + t.replica = true; } /// A replica joins the session recorded on `t` (core/replica.zig): what the @@ -1344,9 +1298,6 @@ pub fn adoptCore(t: *Tape, p: *Pardes) void { /// input, for a core made from a dump, which has neither. pub fn resync(t: *Tape) void { t.seen = @splat(0); - if (t.core) |p| if (p.host.vtable == &t.vtable) { - p.host = t.real; - }; t.real = .{}; } @@ -1473,6 +1424,7 @@ pub fn release(t: *Tape) void { /// tape's core as the authority applied them, each digest checked; why /// they diverged, or null. pub fn replayUnit(t: *Tape, bytes: []const u8) ?[]const u8 { + t.replica = true; t.replay = true; t.speculating = false; defer t.replay = false; |
