diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index 66906609504224..10ba9fca8ef8c7 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -52,12 +52,14 @@ pub const ZigGlobalObject = extern struct { pub const Interface: type = NewGlobalObject(JS.VirtualMachine); pub fn create( + vm: *JSC.VirtualMachine, console: *anyopaque, context_id: i32, mini_mode: bool, eval_mode: bool, worker_ptr: ?*anyopaque, ) *JSGlobalObject { + vm.eventLoop().ensureWaker(); const global = shim.cppFn("create", .{ console, context_id, mini_mode, eval_mode, worker_ptr }); // JSC might mess with the stack size. diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index db9e5e5fbefbad..44b410e8b6db85 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -1935,7 +1935,6 @@ pub const VirtualMachine = struct { vm.regular_event_loop.tasks.ensureUnusedCapacity(64) catch unreachable; vm.regular_event_loop.concurrent_tasks = .{}; vm.event_loop = &vm.regular_event_loop; - vm.eventLoop().ensureWaker(); vm.transpiler.macro_context = null; vm.transpiler.resolver.store_fd = false; @@ -1957,6 +1956,7 @@ pub const VirtualMachine = struct { VMHolder.main_thread_vm = vm; } vm.global = ZigGlobalObject.create( + vm, vm.console, if (opts.is_main_thread) -1 else std.math.maxInt(i32), false, @@ -2057,7 +2057,6 @@ pub const VirtualMachine = struct { vm.regular_event_loop.tasks.ensureUnusedCapacity(64) catch unreachable; vm.regular_event_loop.concurrent_tasks = .{}; vm.event_loop = &vm.regular_event_loop; - vm.eventLoop().ensureWaker(); vm.transpiler.macro_context = null; vm.transpiler.resolver.store_fd = opts.store_fd; @@ -2074,6 +2073,7 @@ pub const VirtualMachine = struct { vm.transpiler.macro_context = js_ast.Macro.MacroContext.init(&vm.transpiler); vm.global = ZigGlobalObject.create( + vm, vm.console, if (opts.is_main_thread) -1 else std.math.maxInt(i32), opts.smol, @@ -2218,7 +2218,6 @@ pub const VirtualMachine = struct { vm.regular_event_loop.tasks.ensureUnusedCapacity(64) catch unreachable; vm.regular_event_loop.concurrent_tasks = .{}; vm.event_loop = &vm.regular_event_loop; - vm.eventLoop().ensureWaker(); vm.hot_reload = worker.parent.hot_reload; vm.transpiler.macro_context = null; vm.transpiler.resolver.store_fd = opts.store_fd; @@ -2240,6 +2239,7 @@ pub const VirtualMachine = struct { vm.transpiler.macro_context = js_ast.Macro.MacroContext.init(&vm.transpiler); vm.global = ZigGlobalObject.create( + vm, vm.console, @as(i32, @intCast(worker.execution_context_id)), worker.mini,