diff options
Diffstat (limited to 'src/lane.cpp')
-rw-r--r-- | src/lane.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lane.cpp b/src/lane.cpp index f220bce..ada1846 100644 --- a/src/lane.cpp +++ b/src/lane.cpp | |||
@@ -802,20 +802,20 @@ Lane::~Lane() | |||
802 | 802 | ||
803 | // ################################################################################################# | 803 | // ################################################################################################# |
804 | 804 | ||
805 | void Lane::changeDebugName(int nameIdx_) | 805 | void Lane::changeDebugName(int const nameIdx_) |
806 | { | 806 | { |
807 | // xxh64 of string "debugName" generated at https://www.pelock.com/products/hash-calculator | 807 | int const _nameIdx{ lua_absindex(L, nameIdx_) }; |
808 | static constexpr RegistryUniqueKey kRegKey{ 0xA194E2645C57F6DDull }; | 808 | luaL_checktype(L, _nameIdx, LUA_TSTRING); // L: ... "name" ... |
809 | nameIdx_ = lua_absindex(L, nameIdx_); | ||
810 | luaL_checktype(L, nameIdx_, LUA_TSTRING); // L: ... "name" ... | ||
811 | STACK_CHECK_START_REL(L, 0); | 809 | STACK_CHECK_START_REL(L, 0); |
812 | // store a hidden reference in the registry to make sure the string is kept around even if a lane decides to manually change the "decoda_name" global... | 810 | // store a hidden reference in the registry to make sure the string is kept around even if a lane decides to manually change the "decoda_name" global... |
813 | kRegKey.setValue(L, [nameIdx = nameIdx_](lua_State* L_) { lua_pushvalue(L_, nameIdx); }); // L: ... "name" ... | 811 | kLaneNameRegKey.setValue(L, [idx = _nameIdx](lua_State* L_) { lua_pushvalue(L_, idx); }); // L: ... "name" ... |
814 | // keep a direct pointer on the string | 812 | // keep a direct pointer on the string |
815 | debugName = lua_tostringview(L, nameIdx_); | 813 | debugName = lua_tostringview(L, _nameIdx); |
816 | // to see VM name in Decoda debugger Virtual Machine window | 814 | if constexpr (HAVE_DECODA_NAME()) { |
817 | lua_pushvalue(L, nameIdx_); // L: ... "name" ... "name" | 815 | // to see VM name in Decoda debugger Virtual Machine window |
818 | lua_setglobal(L, "decoda_name"); // L: ... "name" ... | 816 | lua_pushvalue(L, _nameIdx); // L: ... "name" ... "name" |
817 | lua_setglobal(L, "decoda_name"); // L: ... "name" ... | ||
818 | } | ||
819 | // and finally set the OS thread name | 819 | // and finally set the OS thread name |
820 | THREAD_SETNAME(debugName.data()); | 820 | THREAD_SETNAME(debugName.data()); |
821 | STACK_CHECK(L, 0); | 821 | STACK_CHECK(L, 0); |