aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-15 17:04:00 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-15 17:04:00 -0700
commitbba102c076c1d3067306f771ae15f0d33f4f1bfa (patch)
tree5feed11db330736b93f4e7822e82277dfdf605e0
parent9719ae096d358e29a37762047878ce1c9210d5e0 (diff)
downloadbun-bba102c076c1d3067306f771ae15f0d33f4f1bfa.tar.gz
bun-bba102c076c1d3067306f771ae15f0d33f4f1bfa.tar.zst
bun-bba102c076c1d3067306f771ae15f0d33f4f1bfa.zip
Warn when JIT is disabled
-rw-r--r--src/http.zig3
-rw-r--r--src/javascript/jsc/bindings/bindings.cpp2
-rw-r--r--src/javascript/jsc/bindings/bindings.zig6
-rw-r--r--src/javascript/jsc/bindings/headers-cpp.h2
-rw-r--r--src/javascript/jsc/bindings/headers.h3
-rw-r--r--src/javascript/jsc/bindings/headers.zig1
6 files changed, 14 insertions, 3 deletions
diff --git a/src/http.zig b/src/http.zig
index f0434fcdb..aacc25423 100644
--- a/src/http.zig
+++ b/src/http.zig
@@ -1219,6 +1219,9 @@ pub const RequestContext = struct {
var __arena: std.heap.ArenaAllocator = undefined;
pub fn runLoop(vm: *JavaScript.VirtualMachine, thread: *HandlerThread) !void {
var module_map = ZigGlobalObject.getModuleRegistryMap(vm.global);
+ if (!VM.isJITEnabled()) {
+ Output.prettyErrorln("<red><r>warn:<r> JIT is disabled,,, this is a bug in Bun and/or a permissions problem. JS will run slower.", .{});
+ }
while (true) {
__arena = std.heap.ArenaAllocator.init(vm.allocator);
diff --git a/src/javascript/jsc/bindings/bindings.cpp b/src/javascript/jsc/bindings/bindings.cpp
index d5c5e057d..50e6978b5 100644
--- a/src/javascript/jsc/bindings/bindings.cpp
+++ b/src/javascript/jsc/bindings/bindings.cpp
@@ -1433,6 +1433,8 @@ const WTF__StringImpl *JSC__PropertyName__uid(JSC__PropertyName *arg0) { return
#pragma mark - JSC::VM
+bool JSC__VM__isJITEnabled() { return JSC::Options::useJIT(); }
+
void JSC__VM__shrinkFootprint(JSC__VM *arg0) { arg0->shrinkFootprintWhenIdle(); };
void JSC__VM__whenIdle(JSC__VM *arg0, void (*ArgFn1)()) { arg0->whenIdle(ArgFn1); };
diff --git a/src/javascript/jsc/bindings/bindings.zig b/src/javascript/jsc/bindings/bindings.zig
index 4f9d5595e..ee55b5f4e 100644
--- a/src/javascript/jsc/bindings/bindings.zig
+++ b/src/javascript/jsc/bindings/bindings.zig
@@ -1559,6 +1559,10 @@ pub const VM = extern struct {
return cppFn("deinit", .{ vm, global_object });
}
+ pub fn isJITEnabled() bool {
+ return cppFn("isJITEnabled", .{});
+ }
+
pub fn deleteAllCode(
vm: *VM,
global_object: *JSGlobalObject,
@@ -1623,7 +1627,7 @@ pub const VM = extern struct {
});
}
- pub const Extern = [_][]const u8{ "deleteAllCode", "apiLock", "create", "deinit", "setExecutionForbidden", "executionForbidden", "isEntered", "throwError", "drainMicrotasks", "whenIdle", "shrinkFootprint" };
+ pub const Extern = [_][]const u8{ "isJITEnabled", "deleteAllCode", "apiLock", "create", "deinit", "setExecutionForbidden", "executionForbidden", "isEntered", "throwError", "drainMicrotasks", "whenIdle", "shrinkFootprint" };
};
pub const ThrowScope = extern struct {
diff --git a/src/javascript/jsc/bindings/headers-cpp.h b/src/javascript/jsc/bindings/headers-cpp.h
index 759a5aad1..7ea94d875 100644
--- a/src/javascript/jsc/bindings/headers-cpp.h
+++ b/src/javascript/jsc/bindings/headers-cpp.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1631593539
+//-- AUTOGENERATED FILE -- 1631749917
// clang-format off
#pragma once
diff --git a/src/javascript/jsc/bindings/headers.h b/src/javascript/jsc/bindings/headers.h
index 5a6c010aa..e40651476 100644
--- a/src/javascript/jsc/bindings/headers.h
+++ b/src/javascript/jsc/bindings/headers.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1631593539
+//-- AUTOGENERATED FILE -- 1631749917
// clang-format: off
#pragma once
@@ -494,6 +494,7 @@ CPP_DECL void JSC__VM__deleteAllCode(JSC__VM* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL void JSC__VM__drainMicrotasks(JSC__VM* arg0);
CPP_DECL bool JSC__VM__executionForbidden(JSC__VM* arg0);
CPP_DECL bool JSC__VM__isEntered(JSC__VM* arg0);
+CPP_DECL bool JSC__VM__isJITEnabled();
CPP_DECL void JSC__VM__setExecutionForbidden(JSC__VM* arg0, bool arg1);
CPP_DECL void JSC__VM__shrinkFootprint(JSC__VM* arg0);
CPP_DECL bool JSC__VM__throwError(JSC__VM* arg0, JSC__JSGlobalObject* arg1, JSC__ThrowScope* arg2, const unsigned char* arg3, size_t arg4);
diff --git a/src/javascript/jsc/bindings/headers.zig b/src/javascript/jsc/bindings/headers.zig
index f34816253..2fd0758e6 100644
--- a/src/javascript/jsc/bindings/headers.zig
+++ b/src/javascript/jsc/bindings/headers.zig
@@ -308,6 +308,7 @@ pub extern fn JSC__VM__deleteAllCode(arg0: [*c]JSC__VM, arg1: [*c]JSC__JSGlobalO
pub extern fn JSC__VM__drainMicrotasks(arg0: [*c]JSC__VM) void;
pub extern fn JSC__VM__executionForbidden(arg0: [*c]JSC__VM) bool;
pub extern fn JSC__VM__isEntered(arg0: [*c]JSC__VM) bool;
+pub extern fn JSC__VM__isJITEnabled(...) bool;
pub extern fn JSC__VM__setExecutionForbidden(arg0: [*c]JSC__VM, arg1: bool) void;
pub extern fn JSC__VM__shrinkFootprint(arg0: [*c]JSC__VM) void;
pub extern fn JSC__VM__throwError(arg0: [*c]JSC__VM, arg1: [*c]JSC__JSGlobalObject, arg2: [*c]JSC__ThrowScope, arg3: [*c]const u8, arg4: usize) bool;