Skip to content

Commit fea39c1

Browse files
committed
WIP
1 parent 8676bb8 commit fea39c1

File tree

5 files changed

+1134
-877
lines changed

5 files changed

+1134
-877
lines changed

src/instance.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const Global = @import("store/global.zig").Global;
1111
const Elem = @import("store/elem.zig").Elem;
1212
const Data = @import("store/data.zig").Data;
1313
const VirtualMachine = @import("instance/vm.zig").VirtualMachine;
14+
const Instruction = VirtualMachine.Instruction;
1415

1516
const VirtualMachineOptions = struct {
1617
frame_stack_size: comptime_int = 1024,
@@ -322,7 +323,7 @@ pub const Instance = struct {
322323
try vm.pushLabel(VirtualMachine.Label{
323324
.return_arity = function.results.len,
324325
.op_stack_len = locals_start,
325-
.branch_target = 0,
326+
.branch_target = @ptrCast([*]Instruction, &self.module.instructions.items[0]),
326327
});
327328

328329
// 8. Execute our function
@@ -371,7 +372,7 @@ pub const Instance = struct {
371372
try vm.pushLabel(VirtualMachine.Label{
372373
.return_arity = 0,
373374
.op_stack_len = locals_start,
374-
.branch_target = 0,
375+
.branch_target = @ptrCast([*]Instruction, &self.module.instructions.items[0]),
375376
});
376377

377378
try vm.invoke(f.start);
@@ -402,6 +403,7 @@ pub const Instance = struct {
402403
try vm.pushLabel(VirtualMachine.Label{
403404
.return_arity = 1,
404405
.op_stack_len = locals_start,
406+
.branch_target = @ptrCast([*]Instruction, &self.module.instructions.items[0]),
405407
});
406408

407409
try vm.invoke(start);

0 commit comments

Comments
 (0)