diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-23 17:43:26 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-23 17:43:26 +0200 |
commit | 3be94c4282bbe77895e952afb12a81e55c2a4391 (patch) | |
tree | 29f18dc65a457aa5d5e63f04a2c8ae0f913a7cd9 /src | |
parent | bf4114ca8b869054a14374d8493d7024b7d75afb (diff) | |
download | lanes-3be94c4282bbe77895e952afb12a81e55c2a4391.tar.gz lanes-3be94c4282bbe77895e952afb12a81e55c2a4391.tar.bz2 lanes-3be94c4282bbe77895e952afb12a81e55c2a4391.zip |
DEBUGSPEW_PARAM_COMMA(Universe* U_)
Diffstat (limited to 'src')
-rw-r--r-- | src/intercopycontext.cpp | 6 | ||||
-rw-r--r-- | src/lanes.cpp | 6 | ||||
-rw-r--r-- | src/state.cpp | 16 | ||||
-rw-r--r-- | src/state.h | 2 | ||||
-rw-r--r-- | src/tools.cpp | 34 | ||||
-rw-r--r-- | src/universe.cpp | 2 | ||||
-rw-r--r-- | src/universe.h | 4 |
7 files changed, 36 insertions, 34 deletions
diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index 6623b16..adbb502 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp | |||
@@ -1165,10 +1165,10 @@ static char const* vt_names[] = { | |||
1165 | DEBUGSPEW_CODE(DebugSpewIndentScope scope); | 1165 | DEBUGSPEW_CODE(DebugSpewIndentScope scope); |
1166 | 1166 | ||
1167 | public: | 1167 | public: |
1168 | OnExit(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L2_) | 1168 | OnExit(lua_State* L2_) |
1169 | : L2{ L2_ } | 1169 | : L2{ L2_ } |
1170 | , top_L2{ lua_gettop(L2) } | 1170 | , top_L2{ lua_gettop(L2) } |
1171 | DEBUGSPEW_COMMA_PARAM(scope{ U_ }) | 1171 | DEBUGSPEW_COMMA_PARAM(scope{ universe_get(L2_) }) |
1172 | { | 1172 | { |
1173 | } | 1173 | } |
1174 | 1174 | ||
@@ -1176,7 +1176,7 @@ static char const* vt_names[] = { | |||
1176 | { | 1176 | { |
1177 | lua_settop(L2, top_L2); | 1177 | lua_settop(L2, top_L2); |
1178 | } | 1178 | } |
1179 | } onExit{ DEBUGSPEW_PARAM_COMMA(U) L2 }; | 1179 | } const _onExit{ L2 }; |
1180 | 1180 | ||
1181 | STACK_CHECK_START_REL(L1, 0); | 1181 | STACK_CHECK_START_REL(L1, 0); |
1182 | if (lua_type_as_enum(L1, L1_i) != LuaType::TABLE) { | 1182 | if (lua_type_as_enum(L1, L1_i) != LuaType::TABLE) { |
diff --git a/src/lanes.cpp b/src/lanes.cpp index a5c9c8b..000668a 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
@@ -342,7 +342,7 @@ LUAG_FUNC(lane_new) | |||
342 | lane->ready.count_down(); | 342 | lane->ready.count_down(); |
343 | lane = nullptr; | 343 | lane = nullptr; |
344 | } | 344 | } |
345 | } onExit{ L_, _lane}; | 345 | } _onExit{ L_, _lane}; |
346 | // launch the thread early, it will sync with a std::latch to parallelize OS thread warmup and L2 preparation | 346 | // launch the thread early, it will sync with a std::latch to parallelize OS thread warmup and L2 preparation |
347 | DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: launching thread" << std::endl); | 347 | DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: launching thread" << std::endl); |
348 | // public Lanes API accepts a generic range -3/+3 | 348 | // public Lanes API accepts a generic range -3/+3 |
@@ -497,7 +497,7 @@ LUAG_FUNC(lane_new) | |||
497 | 497 | ||
498 | STACK_CHECK_RESET_REL(L_, 0); | 498 | STACK_CHECK_RESET_REL(L_, 0); |
499 | // all went well, the lane's thread can start working | 499 | // all went well, the lane's thread can start working |
500 | onExit.success(); // L_: [fixed] lane L2: <living its own life> | 500 | _onExit.success(); // L_: [fixed] lane L2: <living its own life> |
501 | // we should have the lane userdata on top of the stack | 501 | // we should have the lane userdata on top of the stack |
502 | STACK_CHECK(L_, 1); | 502 | STACK_CHECK(L_, 1); |
503 | return 1; | 503 | return 1; |
@@ -681,7 +681,7 @@ LUAG_FUNC(configure) | |||
681 | STACK_CHECK(L_, 1); | 681 | STACK_CHECK(L_, 1); |
682 | 682 | ||
683 | // Serialize calls to 'require' from now on, also in the primary state | 683 | // Serialize calls to 'require' from now on, also in the primary state |
684 | serialize_require(DEBUGSPEW_PARAM_COMMA(_U) L_); | 684 | serialize_require(L_); |
685 | 685 | ||
686 | // Retrieve main module interface table | 686 | // Retrieve main module interface table |
687 | lua_pushvalue(L_, lua_upvalueindex(2)); // L_: settings M | 687 | lua_pushvalue(L_, lua_upvalueindex(2)); // L_: settings M |
diff --git a/src/state.cpp b/src/state.cpp index 08ed111..7ce8db0 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -84,11 +84,11 @@ THE SOFTWARE. | |||
84 | /* | 84 | /* |
85 | * Serialize calls to 'require', if it exists | 85 | * Serialize calls to 'require', if it exists |
86 | */ | 86 | */ |
87 | void serialize_require(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_) | 87 | void serialize_require(lua_State* L_) |
88 | { | 88 | { |
89 | STACK_GROW(L_, 1); | 89 | STACK_GROW(L_, 1); |
90 | STACK_CHECK_START_REL(L_, 0); | 90 | STACK_CHECK_START_REL(L_, 0); |
91 | DEBUGSPEW_CODE(DebugSpew(U_) << "serializing require()" << std::endl); | 91 | DEBUGSPEW_CODE(DebugSpew(universe_get(L_)) << "serializing require()" << std::endl); |
92 | 92 | ||
93 | // Check 'require' is there and not already wrapped; if not, do nothing | 93 | // Check 'require' is there and not already wrapped; if not, do nothing |
94 | // | 94 | // |
@@ -155,7 +155,7 @@ namespace global | |||
155 | 155 | ||
156 | // ################################################################################################# | 156 | // ################################################################################################# |
157 | 157 | ||
158 | static void open1lib(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, std::string_view const& name_) | 158 | static void open1lib(lua_State* L_, std::string_view const& name_) |
159 | { | 159 | { |
160 | for (luaL_Reg const& _entry : global::sLibs) { | 160 | for (luaL_Reg const& _entry : global::sLibs) { |
161 | if (name_ == _entry.name) { | 161 | if (name_ == _entry.name) { |
@@ -164,7 +164,7 @@ static void open1lib(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, std::str | |||
164 | break; | 164 | break; |
165 | } | 165 | } |
166 | std::string_view const _name{ _entry.name }; | 166 | std::string_view const _name{ _entry.name }; |
167 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening '" << _name << "' library" << std::endl); | 167 | DEBUGSPEW_CODE(DebugSpew(universe_get(L_)) << "opening '" << _name << "' library" << std::endl); |
168 | STACK_CHECK_START_REL(L_, 0); | 168 | STACK_CHECK_START_REL(L_, 0); |
169 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) | 169 | // open the library as if through require(), and create a global as well if necessary (the library table is left on the stack) |
170 | bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" | 170 | bool const isLanesCore{ _libfunc == require_lanes_core }; // don't want to create a global for "lanes.core" |
@@ -352,12 +352,12 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
352 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening ALL standard libraries" << std::endl); | 352 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening ALL standard libraries" << std::endl); |
353 | luaL_openlibs(_L); | 353 | luaL_openlibs(_L); |
354 | // don't forget lanes.core for regular lane states | 354 | // don't forget lanes.core for regular lane states |
355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); | 355 | open1lib(_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 | 358 | #if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, always open jit |
359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); | 359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); |
360 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, LUA_JITLIBNAME); | 360 | open1lib(_L, LUA_JITLIBNAME); |
361 | #endif // LUAJIT_FLAVOR() | 361 | #endif // LUAJIT_FLAVOR() |
362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); | 362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); |
363 | #if LUA_VERSION_NUM >= 502 | 363 | #if LUA_VERSION_NUM >= 502 |
@@ -385,12 +385,12 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
385 | while (isalnum(_p[_len]) || _p[_len] == '.') | 385 | while (isalnum(_p[_len]) || _p[_len] == '.') |
386 | ++_len; | 386 | ++_len; |
387 | // open library | 387 | // open library |
388 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, { _p, _len }); | 388 | open1lib(_L, { _p, _len }); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | lua_gc(_L, LUA_GCRESTART, 0); | 391 | lua_gc(_L, LUA_GCRESTART, 0); |
392 | 392 | ||
393 | serialize_require(DEBUGSPEW_PARAM_COMMA(U_) _L); | 393 | serialize_require(_L); |
394 | 394 | ||
395 | // call this after the base libraries are loaded and GC is restarted | 395 | // call this after the base libraries are loaded and GC is restarted |
396 | // will raise an error in from_ in case of problem | 396 | // will raise an error in from_ in case of problem |
diff --git a/src/state.h b/src/state.h index 626a696..5334c90 100644 --- a/src/state.h +++ b/src/state.h | |||
@@ -7,7 +7,7 @@ | |||
7 | enum class LookupMode; | 7 | enum class LookupMode; |
8 | class Universe; | 8 | class Universe; |
9 | 9 | ||
10 | void serialize_require(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_); | 10 | void serialize_require(lua_State* L_); |
11 | 11 | ||
12 | // ################################################################################################# | 12 | // ################################################################################################# |
13 | 13 | ||
diff --git a/src/tools.cpp b/src/tools.cpp index 5f12995..1d778ef 100644 --- a/src/tools.cpp +++ b/src/tools.cpp | |||
@@ -122,15 +122,16 @@ static constexpr int kWriterReturnCode{ 666 }; | |||
122 | * if we already had an entry of type [o] = ..., replace the name if the new one is shorter | 122 | * if we already had an entry of type [o] = ..., replace the name if the new one is shorter |
123 | * pops the processed object from the stack | 123 | * pops the processed object from the stack |
124 | */ | 124 | */ |
125 | static void update_lookup_entry(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, int ctxBase_, int depth_) | 125 | static void update_lookup_entry(lua_State* L_, int ctxBase_, int depth_) |
126 | { | 126 | { |
127 | // slot 1 in the stack contains the table that receives everything we found | 127 | // slot 1 in the stack contains the table that receives everything we found |
128 | int const _dest{ ctxBase_ }; | 128 | int const _dest{ ctxBase_ }; |
129 | // slot 2 contains a table that, when concatenated, produces the fully qualified name of scanned elements in the table provided at slot _i | 129 | // slot 2 contains a table that, when concatenated, produces the fully qualified name of scanned elements in the table provided at slot _i |
130 | int const _fqn{ ctxBase_ + 1 }; | 130 | int const _fqn{ ctxBase_ + 1 }; |
131 | 131 | ||
132 | DEBUGSPEW_CODE(DebugSpew(U_) << "update_lookup_entry()" << std::endl); | 132 | DEBUGSPEW_CODE(Universe* const _U{ universe_get(L_) }); |
133 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); | 133 | DEBUGSPEW_CODE(DebugSpew(_U) << "update_lookup_entry()" << std::endl); |
134 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); | ||
134 | 135 | ||
135 | STACK_CHECK_START_REL(L_, 0); | 136 | STACK_CHECK_START_REL(L_, 0); |
136 | // first, raise an error if the function is already known | 137 | // first, raise an error if the function is already known |
@@ -154,7 +155,7 @@ static void update_lookup_entry(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L | |||
154 | // Therefore, when we encounter an object for which a name was previously registered, we need to select the names | 155 | // Therefore, when we encounter an object for which a name was previously registered, we need to select the names |
155 | // based on some sorting order so that we end up with the same name in all databases whatever order the table walk yielded | 156 | // based on some sorting order so that we end up with the same name in all databases whatever order the table walk yielded |
156 | if (!_prevName.empty() && (_prevName.size() < _newName.size() || lua_lessthan(L_, -2, -1))) { | 157 | if (!_prevName.empty() && (_prevName.size() < _newName.size() || lua_lessthan(L_, -2, -1))) { |
157 | DEBUGSPEW_CODE(DebugSpew(U_) << lua_typename(L_, lua_type(L_, -3)) << " '" << _newName << "' remains named '" << _prevName << "'" << std::endl); | 158 | DEBUGSPEW_CODE(DebugSpew(_U) << lua_typename(L_, lua_type(L_, -3)) << " '" << _newName << "' remains named '" << _prevName << "'" << std::endl); |
158 | // the previous name is 'smaller' than the one we just generated: keep it! | 159 | // the previous name is 'smaller' than the one we just generated: keep it! |
159 | lua_pop(L_, 3); // L_: ... {bfc} k | 160 | lua_pop(L_, 3); // L_: ... {bfc} k |
160 | } else { | 161 | } else { |
@@ -168,7 +169,7 @@ static void update_lookup_entry(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L | |||
168 | } else { | 169 | } else { |
169 | lua_remove(L_, -2); // L_: ... {bfc} k o "f.q.n" | 170 | lua_remove(L_, -2); // L_: ... {bfc} k o "f.q.n" |
170 | } | 171 | } |
171 | DEBUGSPEW_CODE(DebugSpew(U_) << lua_typename(L_, lua_type(L_, -2)) << " '" << _newName << "'" << std::endl); | 172 | DEBUGSPEW_CODE(DebugSpew(_U) << lua_typename(L_, lua_type(L_, -2)) << " '" << _newName << "'" << std::endl); |
172 | // prepare the stack for database feed | 173 | // prepare the stack for database feed |
173 | lua_pushvalue(L_, -1); // L_: ... {bfc} k o "f.q.n" "f.q.n" | 174 | lua_pushvalue(L_, -1); // L_: ... {bfc} k o "f.q.n" "f.q.n" |
174 | lua_pushvalue(L_, -3); // L_: ... {bfc} k o "f.q.n" "f.q.n" o | 175 | lua_pushvalue(L_, -3); // L_: ... {bfc} k o "f.q.n" "f.q.n" o |
@@ -188,15 +189,16 @@ static void update_lookup_entry(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L | |||
188 | 189 | ||
189 | // ################################################################################################# | 190 | // ################################################################################################# |
190 | 191 | ||
191 | static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U_) lua_State* L_, int dbIdx_, int i_, int depth_) | 192 | static void populate_func_lookup_table_recur(lua_State* L_, int dbIdx_, int i_, int depth_) |
192 | { | 193 | { |
193 | // slot dbIdx_ contains the lookup database table | 194 | // slot dbIdx_ contains the lookup database table |
194 | // slot dbIdx_ + 1 contains a table that, when concatenated, produces the fully qualified name of scanned elements in the table provided at slot i_ | 195 | // slot dbIdx_ + 1 contains a table that, when concatenated, produces the fully qualified name of scanned elements in the table provided at slot i_ |
195 | int const _fqn{ dbIdx_ + 1 }; | 196 | int const _fqn{ dbIdx_ + 1 }; |
196 | // slot dbIdx_ + 2 contains a cache that stores all already visited tables to avoid infinite recursion loops | 197 | // slot dbIdx_ + 2 contains a cache that stores all already visited tables to avoid infinite recursion loops |
197 | int const _cache{ dbIdx_ + 2 }; | 198 | int const _cache{ dbIdx_ + 2 }; |
198 | DEBUGSPEW_CODE(DebugSpew(U_) << "populate_func_lookup_table_recur()" << std::endl); | 199 | DEBUGSPEW_CODE(Universe* const _U{ universe_get(L_) }); |
199 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); | 200 | DEBUGSPEW_CODE(DebugSpew(_U) << "populate_func_lookup_table_recur()" << std::endl); |
201 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); | ||
200 | 202 | ||
201 | STACK_GROW(L_, 6); | 203 | STACK_GROW(L_, 6); |
202 | // slot i_ contains a table where we search for functions (or a full userdata with a metatable) | 204 | // slot i_ contains a table where we search for functions (or a full userdata with a metatable) |
@@ -215,7 +217,7 @@ static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U_) | |||
215 | lua_pop(L_, 1); // L_: ... {i_} | 217 | lua_pop(L_, 1); // L_: ... {i_} |
216 | STACK_CHECK(L_, 0); | 218 | STACK_CHECK(L_, 0); |
217 | if (_visit_count > 0) { | 219 | if (_visit_count > 0) { |
218 | DEBUGSPEW_CODE(DebugSpew(U_) << "already visited" << std::endl); | 220 | DEBUGSPEW_CODE(DebugSpew(_U) << "already visited" << std::endl); |
219 | return; | 221 | return; |
220 | } | 222 | } |
221 | 223 | ||
@@ -248,11 +250,11 @@ static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U_) | |||
248 | lua_pushvalue(L_, -2); // L_: ... {i_} {bfc} k {} k {} | 250 | lua_pushvalue(L_, -2); // L_: ... {i_} {bfc} k {} k {} |
249 | lua_rawset(L_, breadthFirstCache); // L_: ... {i_} {bfc} k {} | 251 | lua_rawset(L_, breadthFirstCache); // L_: ... {i_} {bfc} k {} |
250 | // generate a name, and if we already had one name, keep whichever is the shorter | 252 | // generate a name, and if we already had one name, keep whichever is the shorter |
251 | update_lookup_entry(DEBUGSPEW_PARAM_COMMA(U_) L_, dbIdx_, depth_); // L_: ... {i_} {bfc} k | 253 | update_lookup_entry(L_, dbIdx_, depth_); // L_: ... {i_} {bfc} k |
252 | } else if (lua_isfunction(L_, -1) && (luaG_getfuncsubtype(L_, -1) != FuncSubType::Bytecode)) { | 254 | } else if (lua_isfunction(L_, -1) && (luaG_getfuncsubtype(L_, -1) != FuncSubType::Bytecode)) { |
253 | // generate a name, and if we already had one name, keep whichever is the shorter | 255 | // generate a name, and if we already had one name, keep whichever is the shorter |
254 | // this pops the function from the stack | 256 | // this pops the function from the stack |
255 | update_lookup_entry(DEBUGSPEW_PARAM_COMMA(U_) L_, dbIdx_, depth_); // L_: ... {i_} {bfc} k | 257 | update_lookup_entry(L_, dbIdx_, depth_); // L_: ... {i_} {bfc} k |
256 | } else { | 258 | } else { |
257 | lua_pop(L_, 1); // L_: ... {i_} {bfc} k | 259 | lua_pop(L_, 1); // L_: ... {i_} {bfc} k |
258 | } | 260 | } |
@@ -263,8 +265,8 @@ static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U_) | |||
263 | lua_pushnil(L_); // L_: ... {i_} {bfc} nil | 265 | lua_pushnil(L_); // L_: ... {i_} {bfc} nil |
264 | while (lua_next(L_, breadthFirstCache) != 0) { // L_: ... {i_} {bfc} k {} | 266 | while (lua_next(L_, breadthFirstCache) != 0) { // L_: ... {i_} {bfc} k {} |
265 | DEBUGSPEW_CODE(std::string_view const _key{ (lua_type(L_, -2) == LUA_TSTRING) ? lua_tostringview(L_, -2) : std::string_view{ "<not a string>" } }); | 267 | DEBUGSPEW_CODE(std::string_view const _key{ (lua_type(L_, -2) == LUA_TSTRING) ? lua_tostringview(L_, -2) : std::string_view{ "<not a string>" } }); |
266 | DEBUGSPEW_CODE(DebugSpew(U_) << "table '"<< _key <<"'" << std::endl); | 268 | DEBUGSPEW_CODE(DebugSpew(_U) << "table '"<< _key <<"'" << std::endl); |
267 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope2{ U_ }); | 269 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope2{ _U }); |
268 | // un-visit this table in case we do need to process it | 270 | // un-visit this table in case we do need to process it |
269 | lua_pushvalue(L_, -1); // L_: ... {i_} {bfc} k {} {} | 271 | lua_pushvalue(L_, -1); // L_: ... {i_} {bfc} k {} {} |
270 | lua_rawget(L_, _cache); // L_: ... {i_} {bfc} k {} n | 272 | lua_rawget(L_, _cache); // L_: ... {i_} {bfc} k {} n |
@@ -281,7 +283,7 @@ static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U_) | |||
281 | // push table name in fqn stack (note that concatenation will crash if name is a not string!) | 283 | // push table name in fqn stack (note that concatenation will crash if name is a not string!) |
282 | lua_pushvalue(L_, -2); // L_: ... {i_} {bfc} k {} k | 284 | lua_pushvalue(L_, -2); // L_: ... {i_} {bfc} k {} k |
283 | lua_rawseti(L_, _fqn, depth_); // L_: ... {i_} {bfc} k {} | 285 | lua_rawseti(L_, _fqn, depth_); // L_: ... {i_} {bfc} k {} |
284 | populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(U_) L_, dbIdx_, lua_gettop(L_), depth_); | 286 | populate_func_lookup_table_recur(L_, dbIdx_, lua_gettop(L_), depth_); |
285 | lua_pop(L_, 1); // L_: ... {i_} {bfc} k | 287 | lua_pop(L_, 1); // L_: ... {i_} {bfc} k |
286 | STACK_CHECK(L_, 2); | 288 | STACK_CHECK(L_, 2); |
287 | } | 289 | } |
@@ -330,7 +332,7 @@ void populate_func_lookup_table(lua_State* const L_, int const i_, std::string_v | |||
330 | std::ignore = lua_pushstringview(L_, _name); // L_: {} {fqn} "name" | 332 | std::ignore = lua_pushstringview(L_, _name); // L_: {} {fqn} "name" |
331 | // generate a name, and if we already had one name, keep whichever is the shorter | 333 | // generate a name, and if we already had one name, keep whichever is the shorter |
332 | lua_pushvalue(L_, _in_base); // L_: {} {fqn} "name" t | 334 | lua_pushvalue(L_, _in_base); // L_: {} {fqn} "name" t |
333 | update_lookup_entry(DEBUGSPEW_PARAM_COMMA(_U) L_, _dbIdx, _startDepth); // L_: {} {fqn} "name" | 335 | update_lookup_entry(L_, _dbIdx, _startDepth); // L_: {} {fqn} "name" |
334 | // don't forget to store the name at the bottom of the fqn stack | 336 | // don't forget to store the name at the bottom of the fqn stack |
335 | lua_rawseti(L_, -2, ++_startDepth); // L_: {} {fqn} | 337 | lua_rawseti(L_, -2, ++_startDepth); // L_: {} {fqn} |
336 | STACK_CHECK(L_, 2); | 338 | STACK_CHECK(L_, 2); |
@@ -338,7 +340,7 @@ void populate_func_lookup_table(lua_State* const L_, int const i_, std::string_v | |||
338 | // retrieve the cache, create it if we haven't done it yet | 340 | // retrieve the cache, create it if we haven't done it yet |
339 | std::ignore = kLookupCacheRegKey.getSubTable(L_, 0, 0); // L_: {} {fqn} {cache} | 341 | std::ignore = kLookupCacheRegKey.getSubTable(L_, 0, 0); // L_: {} {fqn} {cache} |
340 | // process everything we find in that table, filling in lookup data for all functions and tables we see there | 342 | // process everything we find in that table, filling in lookup data for all functions and tables we see there |
341 | populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(_U) L_, _dbIdx, _in_base, _startDepth); | 343 | populate_func_lookup_table_recur(L_, _dbIdx, _in_base, _startDepth); |
342 | lua_pop(L_, 3); // L_: | 344 | lua_pop(L_, 3); // L_: |
343 | } else { | 345 | } else { |
344 | lua_pop(L_, 1); // L_: | 346 | lua_pop(L_, 1); // L_: |
diff --git a/src/universe.cpp b/src/universe.cpp index 0bab844..cdb3d72 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
@@ -262,7 +262,7 @@ void Universe::initializeKeepers(lua_State* L_) | |||
262 | luaL_requiref(_K, LUA_LOADLIBNAME, luaopen_package, 1); // L_: settings K: package | 262 | luaL_requiref(_K, LUA_LOADLIBNAME, luaopen_package, 1); // L_: settings K: package |
263 | lua_pop(_K, 1); // L_: settings K: | 263 | lua_pop(_K, 1); // L_: settings K: |
264 | STACK_CHECK(_K, 0); | 264 | STACK_CHECK(_K, 0); |
265 | serialize_require(DEBUGSPEW_PARAM_COMMA(this) _K); | 265 | serialize_require(_K); |
266 | STACK_CHECK(_K, 0); | 266 | STACK_CHECK(_K, 0); |
267 | 267 | ||
268 | // copy package.path and package.cpath from the source state | 268 | // copy package.path and package.cpath from the source state |
diff --git a/src/universe.h b/src/universe.h index f5327a6..97b613e 100644 --- a/src/universe.h +++ b/src/universe.h | |||
@@ -197,9 +197,9 @@ void universe_store(lua_State* L_, Universe* U_); | |||
197 | [[nodiscard]] inline Universe* universe_get(lua_State* L_) | 197 | [[nodiscard]] inline Universe* universe_get(lua_State* L_) |
198 | { | 198 | { |
199 | STACK_CHECK_START_REL(L_, 0); | 199 | STACK_CHECK_START_REL(L_, 0); |
200 | Universe* const universe{ kUniverseLightRegKey.readLightUserDataValue<Universe>(L_) }; | 200 | Universe* const _universe{ kUniverseLightRegKey.readLightUserDataValue<Universe>(L_) }; |
201 | STACK_CHECK(L_, 0); | 201 | STACK_CHECK(L_, 0); |
202 | return universe; | 202 | return _universe; |
203 | } | 203 | } |
204 | 204 | ||
205 | // ################################################################################################# | 205 | // ################################################################################################# |