authorgravatar for paul@plutojl.orgPaul Berg <paul@plutojl.org> 2024-02-12 14:05:34+01:00
committergravatar for paul@plutojl.orgPaul Berg <paul@plutojl.org> 2024-02-14 09:28:20+01:00
log11381662896e1961df2f94a5f044e892d9baf93a
tree9d90cbbbefb5078da27508d977ed3af72064e0ef
parent3f5593205dd687e9c637d7c34bd05b3ba53c2312

wasm: allow non-int vectors

The current Wasm ABI classification function fails to handle non-integer vectors because of the call to `intInfo`.

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

src/arch/wasm/abi.zig+2-1
...@@ -45,7 +45,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {...@@ -45,7 +45,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
45 }45 }
46 return classifyType(field_ty, mod);46 return classifyType(field_ty, mod);
47 },47 },
48 .Int, .Enum, .ErrorSet, .Vector => {48 .Int, .Enum, .ErrorSet => {
49 const int_bits = ty.intInfo(mod).bits;49 const int_bits = ty.intInfo(mod).bits;
50 if (int_bits <= 64) return direct;50 if (int_bits <= 64) return direct;
51 if (int_bits <= 128) return .{ .direct, .direct };51 if (int_bits <= 128) return .{ .direct, .direct };
...@@ -58,6 +58,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {...@@ -58,6 +58,7 @@ pub fn classifyType(ty: Type, mod: *Module) [2]Class {
58 return memory;58 return memory;
59 },59 },
60 .Bool => return direct,60 .Bool => return direct,
61 .Vector => return direct,
61 .Array => return memory,62 .Array => return memory,
62 .Optional => {63 .Optional => {
63 assert(ty.isPtrLikeOptional(mod));64 assert(ty.isPtrLikeOptional(mod));