aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-03-01 16:46:48 +0100
committerAndrew Kelley <andrew@ziglang.org>2024-03-01 17:42:54 -0800
commitb60fc16b4f6b973ce2207fb28b77606d45961972 (patch)
treeeb90eb7d6cfcfa8d90f821b34c4e6d17e7159e1a /src/arch/wasm/CodeGen.zig
parent155f5274ff4db3bc6e75ae5660cabab5bab22f42 (diff)
downloadzig-b60fc16b4f6b973ce2207fb28b77606d45961972.tar.gz
zig-b60fc16b4f6b973ce2207fb28b77606d45961972.zip
compiler: audit debug mode checks
* Introduce `-Ddebug-extensions` for enabling compiler debug helpers * Replace safety mode checks with `std.debug.runtime_safety` * Replace debugger helper checks with `!builtin.strip_debug_info` Sometimes, you just have to debug optimized compilers...
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 361fd96374..5439cc5c10 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -735,7 +735,7 @@ free_locals_v128: std.ArrayListUnmanaged(u32) = .{},
/// stored in our `values` map and therefore cause bugs.
air_bookkeeping: @TypeOf(bookkeeping_init) = bookkeeping_init,
-const bookkeeping_init = if (builtin.mode == .Debug) @as(usize, 0) else {};
+const bookkeeping_init = if (std.debug.runtime_safety) @as(usize, 0) else {};
const InnerError = error{
OutOfMemory,
@@ -830,7 +830,7 @@ fn finishAir(func: *CodeGen, inst: Air.Inst.Index, result: WValue, operands: []c
branch.values.putAssumeCapacityNoClobber(inst.toRef(), result);
}
- if (builtin.mode == .Debug) {
+ if (std.debug.runtime_safety) {
func.air_bookkeeping += 1;
}
}
@@ -866,7 +866,7 @@ const BigTomb = struct {
bt.gen.currentBranch().values.putAssumeCapacityNoClobber(bt.inst.toRef(), result);
}
- if (builtin.mode == .Debug) {
+ if (std.debug.runtime_safety) {
bt.gen.air_bookkeeping += 1;
}
}
@@ -2079,7 +2079,7 @@ fn genBody(func: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
try func.currentBranch().values.ensureUnusedCapacity(func.gpa, Liveness.bpi);
try func.genInst(inst);
- if (builtin.mode == .Debug and func.air_bookkeeping < old_bookkeeping_value + 1) {
+ if (std.debug.runtime_safety and func.air_bookkeeping < old_bookkeeping_value + 1) {
std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{}')", .{
inst,
func.air.instructions.items(.tag)[@intFromEnum(inst)],