diff options
-rw-r--r-- | src/tools.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/tools.cpp b/src/tools.cpp index 3410f4b..e2ce8b8 100644 --- a/src/tools.cpp +++ b/src/tools.cpp | |||
@@ -200,18 +200,18 @@ void initialize_allocator_function(Universe* U, lua_State* L) | |||
200 | * +-----------------+----------+------------+----------+ | 200 | * +-----------------+----------+------------+----------+ |
201 | */ | 201 | */ |
202 | 202 | ||
203 | enum FuncSubType | 203 | enum class FuncSubType |
204 | { | 204 | { |
205 | FST_Bytecode, | 205 | Bytecode, |
206 | FST_Native, | 206 | Native, |
207 | FST_FastJIT | 207 | FastJIT |
208 | } ; | 208 | } ; |
209 | 209 | ||
210 | FuncSubType luaG_getfuncsubtype(lua_State* L, int _i) | 210 | FuncSubType luaG_getfuncsubtype(lua_State* L, int _i) |
211 | { | 211 | { |
212 | if (lua_tocfunction(L, _i)) // nullptr for LuaJIT-fast && bytecode functions | 212 | if (lua_tocfunction(L, _i)) // nullptr for LuaJIT-fast && bytecode functions |
213 | { | 213 | { |
214 | return FST_Native; | 214 | return FuncSubType::Native; |
215 | } | 215 | } |
216 | { | 216 | { |
217 | int mustpush{ 0 }; | 217 | int mustpush{ 0 }; |
@@ -227,10 +227,10 @@ FuncSubType luaG_getfuncsubtype(lua_State* L, int _i) | |||
227 | lua_pop(L, mustpush); | 227 | lua_pop(L, mustpush); |
228 | if (dumpres == 666) | 228 | if (dumpres == 666) |
229 | { | 229 | { |
230 | return FST_Bytecode; | 230 | return FuncSubType::Bytecode; |
231 | } | 231 | } |
232 | } | 232 | } |
233 | return FST_FastJIT; | 233 | return FuncSubType::FastJIT; |
234 | } | 234 | } |
235 | 235 | ||
236 | // ################################################################################################# | 236 | // ################################################################################################# |
@@ -412,9 +412,10 @@ static void populate_func_lookup_table_recur(DEBUGSPEW_PARAM_COMMA(Universe* U) | |||
412 | // generate a name, and if we already had one name, keep whichever is the shorter | 412 | // generate a name, and if we already had one name, keep whichever is the shorter |
413 | update_lookup_entry( DEBUGSPEW_PARAM_COMMA(U) L, _ctx_base, _depth); // ... {_i} {bfc} k | 413 | update_lookup_entry( DEBUGSPEW_PARAM_COMMA(U) L, _ctx_base, _depth); // ... {_i} {bfc} k |
414 | } | 414 | } |
415 | else if (lua_isfunction(L, -1) && (luaG_getfuncsubtype(L, -1) != FST_Bytecode)) // ... {_i} {bfc} k func | 415 | else if (lua_isfunction(L, -1) && (luaG_getfuncsubtype(L, -1) != FuncSubType::Bytecode)) |
416 | { | 416 | { |
417 | // generate a name, and if we already had one name, keep whichever is the shorter | 417 | // generate a name, and if we already had one name, keep whichever is the shorter |
418 | // this pops the function from the stack | ||
418 | update_lookup_entry( DEBUGSPEW_PARAM_COMMA(U) L, _ctx_base, _depth); // ... {_i} {bfc} k | 419 | update_lookup_entry( DEBUGSPEW_PARAM_COMMA(U) L, _ctx_base, _depth); // ... {_i} {bfc} k |
419 | } | 420 | } |
420 | else | 421 | else |
@@ -1249,16 +1250,15 @@ void InterCopyContext::copy_func() const | |||
1249 | 1250 | ||
1250 | // ################################################################################################# | 1251 | // ################################################################################################# |
1251 | 1252 | ||
1252 | /* | 1253 | /* |
1253 | * Check if we've already copied the same function from 'L', and reuse the old | 1254 | * Check if we've already copied the same function from 'L1', and reuse the old copy. |
1254 | * copy. | ||
1255 | * | 1255 | * |
1256 | * Always pushes a function to 'L2'. | 1256 | * Always pushes a function to 'L2'. |
1257 | */ | 1257 | */ |
1258 | void InterCopyContext::copy_cached_func() const | 1258 | void InterCopyContext::copy_cached_func() const |
1259 | { | 1259 | { |
1260 | FuncSubType const funcSubType{ luaG_getfuncsubtype(L1, L1_i) }; | 1260 | FuncSubType const funcSubType{ luaG_getfuncsubtype(L1, L1_i) }; |
1261 | if (funcSubType == FST_Bytecode) | 1261 | if (funcSubType == FuncSubType::Bytecode) |
1262 | { | 1262 | { |
1263 | void* const aspointer = const_cast<void*>(lua_topointer(L1, L1_i)); | 1263 | void* const aspointer = const_cast<void*>(lua_topointer(L1, L1_i)); |
1264 | // TBD: Merge this and same code for tables | 1264 | // TBD: Merge this and same code for tables |