aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-10 17:21:22 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:42:30 -0700
commit3ba099bfba9d3c38fe188010aa82fc589b1cabf6 (patch)
treeef96b24aa9e6417e4cfa8c421c0a77ef9b75e22c /src/arch/wasm/CodeGen.zig
parent8297f28546b44afe49bec074733f05e03a3c0e62 (diff)
downloadzig-3ba099bfba9d3c38fe188010aa82fc589b1cabf6.tar.gz
zig-3ba099bfba9d3c38fe188010aa82fc589b1cabf6.zip
stage2: move union types and values to InternPool
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 90c26d5d84..c1409e4977 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -1739,8 +1739,8 @@ fn isByRef(ty: Type, mod: *Module) bool {
.Frame,
=> return ty.hasRuntimeBitsIgnoreComptime(mod),
.Union => {
- if (ty.castTag(.@"union")) |union_ty| {
- if (union_ty.data.layout == .Packed) {
+ if (mod.typeToUnion(ty)) |union_obj| {
+ if (union_obj.layout == .Packed) {
return ty.abiSize(mod) > 8;
}
}
@@ -3175,7 +3175,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
},
.Union => {
// in this case we have a packed union which will not be passed by reference.
- const union_ty = ty.cast(Type.Payload.Union).?.data;
+ const union_ty = mod.typeToUnion(ty).?;
const union_obj = val.castTag(.@"union").?.data;
const field_index = ty.unionTagFieldIndex(union_obj.tag, func.bin_file.base.options.module.?).?;
const field_ty = union_ty.fields.values()[field_index].ty;
@@ -5086,12 +5086,12 @@ fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const result = result: {
const union_ty = func.typeOfIndex(inst);
const layout = union_ty.unionGetLayout(mod);
- const union_obj = union_ty.cast(Type.Payload.Union).?.data;
+ const union_obj = mod.typeToUnion(union_ty).?;
const field = union_obj.fields.values()[extra.field_index];
const field_name = union_obj.fields.keys()[extra.field_index];
const tag_int = blk: {
- const tag_ty = union_ty.unionTagTypeHypothetical();
+ const tag_ty = union_ty.unionTagTypeHypothetical(mod);
const enum_field_index = tag_ty.enumFieldIndex(field_name).?;
var tag_val_payload: Value.Payload.U32 = .{
.base = .{ .tag = .enum_field_index },