aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-30 00:47:55 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-30 00:47:55 -0700
commitc21f046a8b019c42aa0dbb0fb9c592b590edf977 (patch)
tree96c7f602f08b00c9cabdd699f8f678de215e50c5 /src/arch/wasm/CodeGen.zig
parent05947ea870f95ab90a75e174079492f546baaf72 (diff)
downloadzig-c21f046a8b019c42aa0dbb0fb9c592b590edf977.tar.gz
zig-c21f046a8b019c42aa0dbb0fb9c592b590edf977.zip
Sema: enhance is_non_err to be comptime more often
* Sema: store the precomputed monomorphed_funcs hash inside Module.Fn. This is important because it may be accessed when resizing monomorphed_funcs while this Fn has already been added to the set, but does not have the owner_decl, comptime_args, or other fields populated yet. * Sema: in `analyzeIsNonErr`, take advantage of the AIR tag being `wrap_errunion_payload` to infer that `is_non_err` is comptime true without performing any error set resolution. - Also add some code to check for empty inferred error sets in this function. If necessary we do resolve the inferred error set. * Sema: queue full type resolution of payload type when `wrap_errunion_payload` AIR instruction is emitted. This ensures the backend may check the alignment of it. * Sema: resolveTypeFully now additionally resolves comptime-only status. closes #11306
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 024a94aaf4..5a191c5276 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2627,12 +2627,12 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) InnerError!WValue {
const op_ty = self.air.typeOf(ty_op.operand);
if (!op_ty.hasRuntimeBitsIgnoreComptime()) return operand;
- const err_ty = self.air.getRefType(ty_op.ty);
- const err_align = err_ty.abiAlignment(self.target);
- const set_size = err_ty.errorUnionSet().abiSize(self.target);
+ const err_union_ty = self.air.getRefType(ty_op.ty);
+ const err_align = err_union_ty.abiAlignment(self.target);
+ const set_size = err_union_ty.errorUnionSet().abiSize(self.target);
const offset = mem.alignForwardGeneric(u64, set_size, err_align);
- const err_union = try self.allocStack(err_ty);
+ const err_union = try self.allocStack(err_union_ty);
const payload_ptr = try self.buildPointerOffset(err_union, offset, .new);
try self.store(payload_ptr, operand, op_ty, 0);