From 5d476135c54799c060918893daee8800b83bf1d9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 1 Sep 2024 21:01:32 -0700 Subject: [PATCH] terminal: do not run page integrity checks unless slow runtime safety --- src/terminal/page.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/terminal/page.zig b/src/terminal/page.zig index d970ba3d1..495eb5680 100644 --- a/src/terminal/page.zig +++ b/src/terminal/page.zig @@ -319,10 +319,12 @@ pub const Page = struct { /// when runtime safety is enabled. This is a no-op when runtime /// safety is disabled. This uses the libc allocator. pub fn assertIntegrity(self: *const Page) void { - self.verifyIntegrity(std.heap.c_allocator) catch |err| { - log.err("page integrity violation, crashing. err={}", .{err}); - @panic("page integrity violation"); - }; + if (comptime build_config.slow_runtime_safety) { + self.verifyIntegrity(std.heap.c_allocator) catch |err| { + log.err("page integrity violation, crashing. err={}", .{err}); + @panic("page integrity violation"); + }; + } } /// Verifies the integrity of the page data. This is not fast,