llvm: fix @wasmMemory{Size,Grow} for wasm64

Closes #19942
This commit is contained in:
Veikka Tuominen
2024-05-20 14:38:59 +03:00
committed by Andrew Kelley
parent d78968c1b5
commit 0fb2015fd3
5 changed files with 12 additions and 10 deletions

View File

@@ -7625,7 +7625,8 @@ pub const FuncGen = struct {
const o = self.dg.object;
const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
const index = pl_op.payload;
return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.size", &.{.i32}, &.{
const llvm_usize = try o.lowerType(Type.usize);
return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.size", &.{llvm_usize}, &.{
try o.builder.intValue(.i32, index),
}, "");
}
@@ -7634,7 +7635,8 @@ pub const FuncGen = struct {
const o = self.dg.object;
const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
const index = pl_op.payload;
return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.grow", &.{.i32}, &.{
const llvm_isize = try o.lowerType(Type.isize);
return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.grow", &.{llvm_isize}, &.{
try o.builder.intValue(.i32, index), try self.resolveInst(pl_op.operand),
}, "");
}