mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-05-21 08:32:02 +03:00
committed by
Andrew Kelley
parent
d78968c1b5
commit
0fb2015fd3
+4
-4
@@ -782,13 +782,13 @@ pub const Inst = struct {
|
||||
field_parent_ptr,
|
||||
|
||||
/// Implements @wasmMemorySize builtin.
|
||||
/// Result type is always `u32`,
|
||||
/// Result type is always `usize`,
|
||||
/// Uses the `pl_op` field, payload represents the index of the target memory.
|
||||
/// The operand is unused and always set to `Ref.none`.
|
||||
wasm_memory_size,
|
||||
|
||||
/// Implements @wasmMemoryGrow builtin.
|
||||
/// Result type is always `i32`,
|
||||
/// Result type is always `isize`,
|
||||
/// Uses the `pl_op` field, payload represents the index of the target memory.
|
||||
wasm_memory_grow,
|
||||
|
||||
@@ -1471,8 +1471,8 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool)
|
||||
.save_err_return_trace_index,
|
||||
=> return Type.usize,
|
||||
|
||||
.wasm_memory_grow => return Type.i32,
|
||||
.wasm_memory_size => return Type.u32,
|
||||
.wasm_memory_grow => return Type.isize,
|
||||
.wasm_memory_size => return Type.usize,
|
||||
|
||||
.int_from_bool => return Type.u1,
|
||||
|
||||
|
||||
+1
-1
@@ -26253,7 +26253,7 @@ fn zirWasmMemoryGrow(
|
||||
const index: u32 = @intCast(try sema.resolveInt(block, index_src, extra.lhs, Type.u32, .{
|
||||
.needed_comptime_reason = "wasm memory size index must be comptime-known",
|
||||
}));
|
||||
const delta = try sema.coerce(block, Type.u32, try sema.resolveInst(extra.rhs), delta_src);
|
||||
const delta = try sema.coerce(block, Type.usize, try sema.resolveInst(extra.rhs), delta_src);
|
||||
|
||||
try sema.requireRuntimeBlock(block, builtin_src, null);
|
||||
return block.addInst(.{
|
||||
|
||||
@@ -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),
|
||||
}, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user