authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-07-14 19:48:42+02:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2022-07-25 06:33:56+02:00
logbf28a47cf23a60539f7cc6cb87309d1a7fa01c18
tree9330aed65b14acc2215d9c670d3687555d0193da
parent7c13bdb1c9c7f61def9b58b1f24072a4eddc54c1
signaturelock-open Commit is signed but in an unrecognized format.

wasm: pass correct abi-size for scalar values

When returning an aggregate type that contains a scalar value (nested), its abi-size is passed by bits, rather than bytes to `buildOpcode`.

1 files changed, 1 insertions(+), 1 deletions(-)

src/arch/wasm/CodeGen.zig+1-1
...@@ -1674,7 +1674,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) InnerError!WValue {...@@ -1674,7 +1674,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) InnerError!WValue {
1674 try self.emitWValue(operand);1674 try self.emitWValue(operand);
1675 const opcode = buildOpcode(.{1675 const opcode = buildOpcode(.{
1676 .op = .load,1676 .op = .load,
1677 .width = @intCast(u8, scalar_type.abiSize(self.target)),1677 .width = @intCast(u8, scalar_type.abiSize(self.target) * 8),
1678 .signedness = if (scalar_type.isSignedInt()) .signed else .unsigned,1678 .signedness = if (scalar_type.isSignedInt()) .signed else .unsigned,
1679 .valtype1 = typeToValtype(scalar_type, self.target),1679 .valtype1 = typeToValtype(scalar_type, self.target),
1680 });1680 });