diff options
Diffstat (limited to 'src/tape.zig')
| -rw-r--r-- | src/tape.zig | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tape.zig b/src/tape.zig index fd5b4b85..eaae601e 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -212,7 +212,7 @@ pub const Tape = struct { arena: std.heap.ArenaAllocator, last_ret: walk.Reader = .{ .bytes = &.{} }, mask: u64 = 0, - headless: bool = false, + skips_render: bool = false, digests: u64 = 0, diverged: ?[]const u8 = null, /// The input being applied, for a divergence's report. @@ -338,7 +338,7 @@ pub const Tape = struct { t.mask = mask; t.vtable = .{}; inline for (host_fns, 0..) |f, i| if (mask & (@as(u64, 1) << i) != 0 or - (t.headless and comptime std.mem.eql(u8, f, "watched"))) + (t.skips_render and comptime std.mem.eql(u8, f, "watched"))) { @field(t.vtable, f) = &Wrap(i).f; }; @@ -399,7 +399,7 @@ pub const Tape = struct { t.diverged = std.fmt.allocPrint(t.gpa, why ++ " (tape byte {d}, in {s})", args ++ .{ t.in.at, t.applying }) catch why; } - /// A host call the headless replica does not make (it draws no frame, + /// A host call a replica that skips render does not make (it draws no frame, /// so presents none): what the host told the core inside it (what it /// presented, `presented`) is applied all the /// same, the host's own calls below it stepped over. @@ -417,7 +417,7 @@ pub const Tape = struct { } } - /// Over a call the replica does not make (the headless one's present), + /// Over a call the replica does not make (a present, in one that skips render), /// what was applied inside it too. fn skip(t: *Tape) void { var depth: usize = 1; @@ -432,7 +432,7 @@ pub const Tape = struct { } /// The records of an input up to its end: what was applied inside it, - /// as it was; the headless replica steps over the host calls it did + /// as it was; a replica that skips render steps over the host calls it did /// not make. fn finishInput(t: *Tape) void { while (t.diverged == null) { @@ -441,7 +441,7 @@ pub const Tape = struct { switch (kind) { .done => return, .set => t.applySet(&rec.payload), - .host => if (t.headless) t.skipHost() else return t.diverge("the core did not make the host call {d} the tape has", .{std.mem.bytesToValue(u16, rec.payload.bytes[0..2])}), + .host => if (t.skips_render) t.skipHost() else return t.diverge("the core did not make the host call {d} the tape has", .{std.mem.bytesToValue(u16, rec.payload.bytes[0..2])}), .input => t.apply(&rec.payload), .digest => t.check(rec.payload.bytes), .ret => return t.diverge("the core's input ended before the recorded one", .{}), @@ -607,7 +607,7 @@ pub const Tape = struct { .perform => |e| p.perform(e), .next_effect => _ = p.nextEffect(), .advance => |now| p.advance(now), - .render => if (t.headless) return t.skip() else { + .render => if (t.skips_render) return t.skip() else { _ = p.frame_arena.reset(.retain_capacity); _ = p.render(p.frame_arena.allocator()) catch {}; }, @@ -809,7 +809,7 @@ fn hostCall(comptime i: usize, comptime R: type, ctx: ?*anyopaque, args: anytype }; if (t.replay) { // A replica that never draws is never watched: it asks no one. - if (comptime std.mem.eql(u8, name, "watched")) if (t.headless) return false; + if (comptime std.mem.eql(u8, name, "watched")) if (t.skips_render) return false; if (!t.expectHost(i, name)) return std.mem.zeroes(R); var ret = t.last_ret; if (R == ?[]const u8) { @@ -1281,15 +1281,15 @@ pub fn replayMain(path: []const u8) u8 { /// digest and dumped to its bytes again: true when none diverged. An /// in-process session's tape too (test/session.zig's replayTape). pub fn replayBytes(gpa: std.mem.Allocator, bytes: []const u8, path: []const u8, dump: bool) bool { - const runs = [_]struct { name: []const u8, headless: bool }{ - .{ .name = "first", .headless = false }, + const runs = [_]struct { name: []const u8, skips_render: bool }{ + .{ .name = "first", .skips_render = false }, // The first replica's memory is still held: this one's lies elsewhere. - .{ .name = "second", .headless = false }, - .{ .name = "headless", .headless = true }, + .{ .name = "second", .skips_render = false }, + .{ .name = "skips-render", .skips_render = true }, }; var failed = false; for (runs) |run| { - var t: Tape = .{ .gpa = gpa, .replay = true, .headless = run.headless, .scratch = .init(gpa), .arena = .init(gpa) }; + var t: Tape = .{ .gpa = gpa, .replay = true, .skips_render = run.skips_render, .scratch = .init(gpa), .arena = .init(gpa) }; t.dump_check = std.mem.eql(u8, run.name, "first") and dump; on = &t; defer on = null; |
