Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmstill committed Jan 30, 2023
1 parent 8676bb8 commit fea39c1
Show file tree
Hide file tree
Showing 5 changed files with 1,134 additions and 877 deletions.
6 changes: 4 additions & 2 deletions src/instance.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Global = @import("store/global.zig").Global;
const Elem = @import("store/elem.zig").Elem;
const Data = @import("store/data.zig").Data;
const VirtualMachine = @import("instance/vm.zig").VirtualMachine;
const Instruction = VirtualMachine.Instruction;

const VirtualMachineOptions = struct {
frame_stack_size: comptime_int = 1024,
Expand Down Expand Up @@ -322,7 +323,7 @@ pub const Instance = struct {
try vm.pushLabel(VirtualMachine.Label{
.return_arity = function.results.len,
.op_stack_len = locals_start,
.branch_target = 0,
.branch_target = @ptrCast([*]Instruction, &self.module.instructions.items[0]),
});

// 8. Execute our function
Expand Down Expand Up @@ -371,7 +372,7 @@ pub const Instance = struct {
try vm.pushLabel(VirtualMachine.Label{
.return_arity = 0,
.op_stack_len = locals_start,
.branch_target = 0,
.branch_target = @ptrCast([*]Instruction, &self.module.instructions.items[0]),
});

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

try vm.invoke(start);
Expand Down
Loading

0 comments on commit fea39c1

Please sign in to comment.