aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2023-02-18 22:05:09 +0200
committerAndrew Kelley <andrew@ziglang.org>2023-02-19 13:54:52 -0500
commitf10950526ea781ee2d15df74398527420cca13a1 (patch)
treeb49b1a4e0690cc7c8d7cb047c644a8301661ab6b /src/arch/wasm/CodeGen.zig
parent02f5d2673f1bb21e7329acdd664fed565ecd4317 (diff)
downloadzig-f10950526ea781ee2d15df74398527420cca13a1.tar.gz
zig-f10950526ea781ee2d15df74398527420cca13a1.zip
implement `writeToMemory`/`readFromMemory` for pointers
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 53dc28626c..b229a67e70 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2896,7 +2896,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
const struct_obj = ty.castTag(.@"struct").?.data;
assert(struct_obj.layout == .Packed);
var buf: [8]u8 = .{0} ** 8; // zero the buffer so we do not read 0xaa as integer
- val.writeToPackedMemory(ty, func.bin_file.base.options.module.?, &buf, 0);
+ val.writeToPackedMemory(ty, func.bin_file.base.options.module.?, &buf, 0) catch unreachable;
var payload: Value.Payload.U64 = .{
.base = .{ .tag = .int_u64 },
.data = std.mem.readIntLittle(u64, &buf),
@@ -2907,7 +2907,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
.Vector => {
assert(determineSimdStoreStrategy(ty, target) == .direct);
var buf: [16]u8 = undefined;
- val.writeToMemory(ty, func.bin_file.base.options.module.?, &buf);
+ val.writeToMemory(ty, func.bin_file.base.options.module.?, &buf) catch unreachable;
return func.storeSimdImmd(buf);
},
else => |zig_type| return func.fail("Wasm TODO: LowerConstant for zigTypeTag {}", .{zig_type}),