summaryrefslogtreecommitdiff
path: root/core/rollback.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/rollback.zig')
-rw-r--r--core/rollback.zig16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/rollback.zig b/core/rollback.zig
index c7d0a4e8..a55d3c87 100644
--- a/core/rollback.zig
+++ b/core/rollback.zig
@@ -404,9 +404,7 @@ pub const Copy = struct {
},
.@"struct" => |s| {
if (comptime walk.machinery(T)) return;
- // A terminal: the authority's (its emulator is never written
- // by a speculation: terminal.zig's guards).
- if (comptime @hasDecl(T, "digest") and @TypeOf(T.digest) == fn (*const T, *walk.Hasher) void) return;
+ if (comptime unwalked(T)) return;
if (s.layout == .@"packed") return;
// std's lists (a safe build's have a third field, a lock).
if (comptime walk.isList(T)) {
@@ -467,7 +465,7 @@ pub const Copy = struct {
if (comptime walk.machinery(P)) return;
const addr = @intFromPtr(ptr);
if (try c.reached(P, addr)) return;
- if (comptime @hasDecl(P, "digest") and @TypeOf(P.digest) == fn (*const P, *walk.Hasher) void) return;
+ if (comptime unwalked(P)) return;
if (c.epoch.?.owns(addr) != null) {
_ = try c.reached(void, addr);
try c.fields(P, ptr);
@@ -513,6 +511,16 @@ pub const Copy = struct {
}
};
+/// A type that hashes itself and says nothing of its fields (`replica`):
+/// a terminal, the authority's (its emulator is never written by a
+/// speculation: terminal.zig's guards), or a location row, made again and
+/// never written. One that says its fields' kinds is walked by them,
+/// whatever digest it has (the 9P state, fs.Namespace and a pane's: a
+/// replayed request writes its buffers in place).
+fn unwalked(comptime T: type) bool {
+ return @hasDecl(T, "digest") and @TypeOf(T.digest) == fn (*const T, *walk.Hasher) void and !@hasDecl(T, "replica");
+}
+
fn annotatedStruct(comptime T: type) bool {
return @typeInfo(T) == .@"struct" and @hasDecl(T, "replica");
}