From 1f0ee56726411a89606726c1de789394d76e9c06 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 May 2024 17:33:59 +0200 Subject: [PATCH 1/3] Fix Lua Session scripts (amend df121269094) --- libs/ardour/luabindings.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index f1a6d3f75d..c872414607 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -3455,7 +3455,7 @@ ARDOUR::Session::luabindings_session_rt (lua_State* L) { /* declaration need to be in this file due to Windows CLASSKEYS */ luabridge::getGlobalNamespace (L) - .beginNamespace ("Ardour") + .beginNamespace ("ARDOUR") .beginClass ("Session") /* thse are private to Session */ .addFunction ("rt_set_controls", &Session::rt_set_controls) From afb519cd8425409829bf4c56a1d791c59a6b23ef Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 May 2024 18:50:17 +0200 Subject: [PATCH 2/3] Bump required boost version to 1.68 (for optional::has_value) --- wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index a11924f964..a10fceeb11 100644 --- a/wscript +++ b/wscript @@ -1199,10 +1199,10 @@ def configure(conf): fragment = "#include \n int main(void) { dlopen (\"\", 0); return 0;}\n", lib='dl', uselib_store='DL', execute = False) - conf.check_cxx(fragment = "#include \n#if !defined (BOOST_VERSION) || BOOST_VERSION < 105600\n#error boost >= 1.56 is not available\n#endif\nint main(void) { return 0; }\n", + conf.check_cxx(fragment = "#include \n#if !defined (BOOST_VERSION) || BOOST_VERSION < 106800\n#error boost >= 1.68 is not available\n#endif\nint main(void) { return 0; }\n", execute = False, mandatory = True, - msg = 'Checking for boost library >= 1.56') + msg = 'Checking for boost library >= 1.68') if re.search ("linux", sys.platform) is not None and Options.options.dist_target != 'mingw': autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA') From 9d046af47a0edf8566140082e0208ba389cc1645 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 May 2024 19:45:13 +0200 Subject: [PATCH 3/3] Update Lua allocator for sessions scripts * increase memory pool (bindings alone require 1.5 MB), and all session scripts have a shared memory pool. * use TLSF (like Lua DSP processors) - this fixes an issue with atomics (notably int62_t, temporal) on macOS and ARM, which need to be aligned. --- libs/ardour/ardour/luaproc.h | 1 - libs/ardour/ardour/session.h | 10 +++++++++- libs/ardour/session.cc | 8 +++++++- libs/ardour/wscript | 2 ++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h index 38d4961480..06478503f5 100644 --- a/libs/ardour/ardour/luaproc.h +++ b/libs/ardour/ardour/luaproc.h @@ -30,7 +30,6 @@ #include #include -#define USE_TLSF #ifdef USE_TLSF # include "pbd/tlsf.h" #else diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index fa61c27f32..5c510473b1 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -60,11 +60,15 @@ #include "pbd/event_loop.h" #include "pbd/file_archive.h" #include "pbd/rcu.h" -#include "pbd/reallocpool.h" #include "pbd/statefuldestructible.h" #include "pbd/signals.h" #include "pbd/undo.h" +#ifdef USE_TLSF +# include "pbd/tlsf.h" +#else +# include "pbd/reallocpool.h" +#endif #include "lua/luastate.h" #include "temporal/range.h" @@ -1652,7 +1656,11 @@ private: bool pending_abort; bool pending_auto_loop; +#ifdef USE_TLSF + PBD::TLSF _mempool; +#else PBD::ReallocPool _mempool; +#endif LuaState lua; mutable Glib::Threads::Mutex lua_lock; luabridge::LuaRef * _lua_run; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 8dab2704e3..4839b1067b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -258,8 +258,14 @@ Session::Session (AudioEngine &eng, , _last_roll_or_reversal_location (0) , _last_record_location (0) , pending_auto_loop (false) - , _mempool ("Session", 3145728) + , _mempool ("Session", 4194304) +#ifdef USE_TLSF + , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool)) +#elif defined USE_MALLOC + , lua (lua_newstate (true, true)) +#else , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) +#endif , _lua_run (0) , _lua_add (0) , _lua_del (0) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 777a0325f1..4743a4eb75 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -321,6 +321,8 @@ def configure(conf): atleast_version='0.24.2', mandatory=True) conf.define ('LV2_SUPPORT', 1) + conf.define ('USE_TLSF', 1) + # non-standard LV2 extention -- TODO: add option to disable?? if conf.is_defined ('HAVE_LV2_1_10_0'): conf.define ('LV2_EXTENDED', 1)