Skip to content

Commit

Permalink
Debugging issue with mem_grow call missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Southporter committed May 21, 2024
1 parent e244ee6 commit b2713b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn build(b: *Build) void {
compile_memtest.addArg("-Wl,--export-dynamic");
compile_memtest.addArg("-o");
compile_memtest.addArg("test/mem64/memtest.wasm");
compile_memtest.addFileArg(.{ .path = "test/mem64/memtest.c" });
compile_memtest.addFileArg(b.path("test/mem64/memtest.c"));
compile_memtest.has_side_effects = true;

b.getInstallStep().dependOn(&compile_memtest.step);
Expand Down
3 changes: 3 additions & 0 deletions src/vm_stack.zig
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ const InstructionFuncs = struct {
};

fn run(pc: u32, code: [*]const Instruction, stack: *Stack) anyerror!void {
std.debug.print("Running code {any}\n", .{code[pc]});
try @call(.always_tail, InstructionFuncs.lookup(code[pc].opcode), .{ pc, code, stack });
}

Expand Down Expand Up @@ -2101,6 +2102,8 @@ const InstructionFuncs = struct {
else => unreachable,
};

std.debug.print("Growing from {} to {}", .{ old_num_pages, num_pages });

if (num_pages >= 0 and memory_instance.grow(@as(usize, @intCast(num_pages)))) {
stack.pushI32(old_num_pages);
try @call(.always_tail, InstructionFuncs.lookup(code[pc + 1].opcode), .{ pc + 1, code, stack });
Expand Down

0 comments on commit b2713b5

Please sign in to comment.