diff --git a/src/ir.cpp b/src/ir.cpp index 3cd861700..86304ff44 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4997,7 +4997,7 @@ static IrInstSrc *ir_build_wasm_memory_size_src(IrBuilderSrc *irb, Scope *scope, static IrInstGen *ir_build_wasm_memory_size_gen(IrAnalyze *ira, IrInst *source_instr, IrInstGen *index) { IrInstGenWasmMemorySize *instruction = ir_build_inst_gen(&ira->new_irb, source_instr->scope, source_instr->source_node); - instruction->base.value->type = ira->codegen->builtin_types.entry_u32; + instruction->base.value->type = ira->codegen->builtin_types.entry_i32; instruction->index = index; ir_ref_inst_gen(index); @@ -5019,7 +5019,7 @@ static IrInstSrc *ir_build_wasm_memory_grow_src(IrBuilderSrc *irb, Scope *scope, static IrInstGen *ir_build_wasm_memory_grow_gen(IrAnalyze *ira, IrInst *source_instr, IrInstGen *index, IrInstGen *delta) { IrInstGenWasmMemoryGrow *instruction = ir_build_inst_gen(&ira->new_irb, source_instr->scope, source_instr->source_node); - instruction->base.value->type = ira->codegen->builtin_types.entry_u32; + instruction->base.value->type = ira->codegen->builtin_types.entry_i32; instruction->index = index; instruction->delta = delta; diff --git a/test/stage1/behavior/wasm.zig b/test/stage1/behavior/wasm.zig index c55700c7c..24557ee19 100644 --- a/test/stage1/behavior/wasm.zig +++ b/test/stage1/behavior/wasm.zig @@ -2,7 +2,7 @@ const std = @import("std"); const expect = std.testing.expect; test "memory size and grow" { - var prev = @wasmMemorySize(); - expect(prev == @wasmMemoryGrow(1)); - expect(prev + 1 == @wasmMemorySize()); + var prev = @wasmMemorySize(0); + expect(prev == @wasmMemoryGrow(0, 1)); + expect(prev + 1 == @wasmMemorySize(0)); }