Browse Source

Call love.jitsetup during thread initialization too.

Miku AuahDark 1 year ago
parent
commit
f4f3105ccd
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/modules/thread/LuaThread.cpp

+ 8 - 0
src/modules/thread/LuaThread.cpp

@@ -24,6 +24,7 @@
 
 
 #ifdef LOVE_BUILD_STANDALONE
 #ifdef LOVE_BUILD_STANDALONE
 extern "C" int luaopen_love(lua_State * L);
 extern "C" int luaopen_love(lua_State * L);
+extern "C" int luaopen_love_jitsetup(lua_State * L);
 #endif // LOVE_BUILD_STANDALONE
 #endif // LOVE_BUILD_STANDALONE
 
 
 namespace love
 namespace love
@@ -54,6 +55,13 @@ void LuaThread::threadFunction()
 	luaL_openlibs(L);
 	luaL_openlibs(L);
 
 
 #ifdef LOVE_BUILD_STANDALONE
 #ifdef LOVE_BUILD_STANDALONE
+	// Call LuaJIT-specific setup again. While it's quite late to call it at
+	// this point, it still needed to turn off JIT compilation (if necessary)
+	// for this thread.
+	luax_preload(L, luaopen_love_jitsetup, "love.jitsetup");
+	luax_require(L, "love.jitsetup");
+	lua_pop(L, 1);
+
 	luax_preload(L, luaopen_love, "love");
 	luax_preload(L, luaopen_love, "love");
 	luax_require(L, "love");
 	luax_require(L, "love");
 	lua_pop(L, 1);
 	lua_pop(L, 1);