@@ -11,6 +11,7 @@ const Global = @import("store/global.zig").Global;
1111const Elem = @import ("store/elem.zig" ).Elem ;
1212const Data = @import ("store/data.zig" ).Data ;
1313const VirtualMachine = @import ("instance/vm.zig" ).VirtualMachine ;
14+ const Instruction = VirtualMachine .Instruction ;
1415
1516const 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