diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-10-23 03:19:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-23 03:19:03 -0400 |
| commit | 94d61ce964cd23fcf46dabeddc19837b4dd3209f (patch) | |
| tree | 00fc6af0a362d7d5744744e3f5e8008136957401 /src/arch/wasm/CodeGen.zig | |
| parent | b82459fa435c366c6af0fee96c3d9b95c24078f9 (diff) | |
| parent | ed82e4f7ac057286444135dda79fb7c6a579573a (diff) | |
| download | zig-94d61ce964cd23fcf46dabeddc19837b4dd3209f.tar.gz zig-94d61ce964cd23fcf46dabeddc19837b4dd3209f.zip | |
Merge pull request #17651 from Vexu/error-limit
Make distinct error limit configurable (attempt #2)
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
| -rw-r--r-- | src/arch/wasm/CodeGen.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 83ab118ac5..44915813fb 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -3302,6 +3302,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue { return WValue{ .imm32 = int }; }, .error_union => |error_union| { + const err_int_ty = try mod.errorIntType(); const err_tv: TypedValue = switch (error_union.val) { .err_name => |err_name| .{ .ty = ty.errorUnionSet(mod), @@ -3311,8 +3312,8 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue { } })).toValue(), }, .payload => .{ - .ty = Type.err_int, - .val = try mod.intValue(Type.err_int, 0), + .ty = err_int_ty, + .val = try mod.intValue(err_int_ty, 0), }, }; const payload_type = ty.errorUnionPayload(mod); @@ -3711,8 +3712,10 @@ fn airCmpLtErrorsLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { const errors_len = WValue{ .memory = sym_index }; try func.emitWValue(operand); - const errors_len_val = try func.load(errors_len, Type.err_int, 0); - const result = try func.cmp(.stack, errors_len_val, Type.err_int, .lt); + const mod = func.bin_file.base.options.module.?; + const err_int_ty = try mod.errorIntType(); + const errors_len_val = try func.load(errors_len, err_int_ty, 0); + const result = try func.cmp(.stack, errors_len_val, err_int_ty, .lt); return func.finishAir(inst, try result.toLocal(func, Type.bool), &.{un_op}); } |
