diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-23 17:07:46 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-23 17:07:46 +0200 |
commit | bf4114ca8b869054a14374d8493d7024b7d75afb (patch) | |
tree | 464990d775a676abbf8400b7aadc8f9b9ec0d57e /src | |
parent | 17ca8b54fdc0aa2df875fc7b80def4dd56959d7f (diff) | |
download | lanes-bf4114ca8b869054a14374d8493d7024b7d75afb.tar.gz lanes-bf4114ca8b869054a14374d8493d7024b7d75afb.tar.bz2 lanes-bf4114ca8b869054a14374d8493d7024b7d75afb.zip |
Automatically initialize "jit" module in new lanes
Diffstat (limited to 'src')
-rw-r--r-- | src/state.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state.cpp b/src/state.cpp index 83b9e85..08ed111 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -344,7 +344,7 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
344 | // 'lua.c' stops GC during initialization so perhaps it is a good idea. :) | 344 | // 'lua.c' stops GC during initialization so perhaps it is a good idea. :) |
345 | lua_gc(_L, LUA_GCSTOP, 0); | 345 | lua_gc(_L, LUA_GCSTOP, 0); |
346 | 346 | ||
347 | // Anything causes 'base' to be taken in | 347 | // Anything causes 'base' and 'jit' to be taken in |
348 | if (libs_ != nullptr) { | 348 | if (libs_ != nullptr) { |
349 | // special "*" case (mainly to help with LuaJIT compatibility) | 349 | // special "*" case (mainly to help with LuaJIT compatibility) |
350 | // as we are called from luaopen_lanes_core() already, and that would deadlock | 350 | // as we are called from luaopen_lanes_core() already, and that would deadlock |
@@ -355,6 +355,10 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); | 355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); |
356 | libs_ = nullptr; // done with libs | 356 | libs_ = nullptr; // done with libs |
357 | } else { | 357 | } else { |
358 | #if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, always open jit | ||
359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); | ||
360 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, LUA_JITLIBNAME); | ||
361 | #endif // LUAJIT_FLAVOR() | ||
358 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); | 362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); |
359 | #if LUA_VERSION_NUM >= 502 | 363 | #if LUA_VERSION_NUM >= 502 |
360 | // open base library the same way as in luaL_openlibs() | 364 | // open base library the same way as in luaL_openlibs() |