parent
3f0a3cea6e
commit
057d97c093
|
@ -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) {
|
static IrInstGen *ir_build_wasm_memory_size_gen(IrAnalyze *ira, IrInst *source_instr, IrInstGen *index) {
|
||||||
IrInstGenWasmMemorySize *instruction = ir_build_inst_gen<IrInstGenWasmMemorySize>(&ira->new_irb,
|
IrInstGenWasmMemorySize *instruction = ir_build_inst_gen<IrInstGenWasmMemorySize>(&ira->new_irb,
|
||||||
source_instr->scope, source_instr->source_node);
|
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->index = index;
|
||||||
|
|
||||||
ir_ref_inst_gen(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) {
|
static IrInstGen *ir_build_wasm_memory_grow_gen(IrAnalyze *ira, IrInst *source_instr, IrInstGen *index, IrInstGen *delta) {
|
||||||
IrInstGenWasmMemoryGrow *instruction = ir_build_inst_gen<IrInstGenWasmMemoryGrow>(&ira->new_irb,
|
IrInstGenWasmMemoryGrow *instruction = ir_build_inst_gen<IrInstGenWasmMemoryGrow>(&ira->new_irb,
|
||||||
source_instr->scope, source_instr->source_node);
|
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->index = index;
|
||||||
instruction->delta = delta;
|
instruction->delta = delta;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ const std = @import("std");
|
||||||
const expect = std.testing.expect;
|
const expect = std.testing.expect;
|
||||||
|
|
||||||
test "memory size and grow" {
|
test "memory size and grow" {
|
||||||
var prev = @wasmMemorySize();
|
var prev = @wasmMemorySize(0);
|
||||||
expect(prev == @wasmMemoryGrow(1));
|
expect(prev == @wasmMemoryGrow(0, 1));
|
||||||
expect(prev + 1 == @wasmMemorySize());
|
expect(prev + 1 == @wasmMemorySize(0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue