summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tape.zig b/src/tape.zig
index d4fb7756..84bdce29 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -163,6 +163,7 @@ pub const Tape = struct {
}
fn flush(t: *Tape) void {
+ if (comptime !pardes.hosted) return;
// A tape in memory (a replica's, an authority's stream) is taken
// by whoever holds it.
if (t.fd < 0) return;
@@ -710,6 +711,8 @@ pub fn value(comptime s: Site, comptime f: anytype, args: anytype) @typeInfo(@Ty
fn call(comptime s: Site, a: ?std.mem.Allocator, comptime f: anytype, args: anytype, comptime yields: bool) @typeInfo(@TypeOf(f)).@"fn".return_type.? {
const R = @typeInfo(@TypeOf(f)).@"fn".return_type.?;
+ // No tape where there is no host to record or replay one.
+ if (comptime !pardes.hosted) return if (yields) out(f, args) else @call(.auto, f, args);
const t = on orelse return if (yields) out(f, args) else @call(.auto, f, args);
const id: u16 = @as(u16, host_fns.len) + @backingInt(s);
if (t.replay) {
@@ -928,6 +931,7 @@ pub fn digestOf(p: *const Pardes) u64 {
/// PARDES_RECORD set: the tape is written from the session's first call.
pub fn startFromEnv() void {
+ if (comptime !pardes.hosted) return;
if (on != null) return;
const prefix = std.mem.span(libc.getenv("PARDES_RECORD") orelse return);
if (prefix.len == 0) return;