aboutsummaryrefslogtreecommitdiff
path: root/src/tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools.c')
-rw-r--r--src/tools.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/tools.c b/src/tools.c
index ecd86b8..f8fc342 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -300,10 +300,8 @@ static lua_CFunction luaG_tocfunction( lua_State *L, int _i, FuncSubType *_out)
300 return p; 300 return p;
301} 301}
302 302
303 303// crc64/we of string "LOOKUPCACHE_REGKEY" generated at http://www.nitrxgen.net/hashgen/
304#define LOOKUP_KEY "ddea37aa-50c7-4d3f-8e0b-fb7a9d62bac5" 304static DECLARE_CONST_UNIQUE_KEY( LOOKUPCACHE_REGKEY, 0x837a68dfc6fcb716);
305#define LOOKUP_KEY_CACHE "d1059270-4976-4193-a55b-c952db5ab7cd"
306
307 305
308// inspired from tconcat() in ltablib.c 306// inspired from tconcat() in ltablib.c
309static char const* luaG_pushFQN( lua_State* L, int t, int last, size_t* length) 307static char const* luaG_pushFQN( lua_State* L, int t, int last, size_t* length)
@@ -576,13 +574,13 @@ void populate_func_lookup_table( lua_State* L, int _i, char const* name_)
576 STACK_MID( L, 2); 574 STACK_MID( L, 2);
577 } 575 }
578 // retrieve the cache, create it if we haven't done it yet 576 // retrieve the cache, create it if we haven't done it yet
579 lua_getfield( L, LUA_REGISTRYINDEX, LOOKUP_KEY_CACHE); // {} {fqn} {cache}? 577 REGISTRY_GET( L, LOOKUPCACHE_REGKEY); // {} {fqn} {cache}?
580 if( lua_isnil( L, -1)) 578 if( lua_isnil( L, -1))
581 { 579 {
582 lua_pop( L, 1); // {} {fqn} 580 lua_pop( L, 1); // {} {fqn}
583 lua_newtable( L); // {} {fqn} {cache} 581 lua_newtable( L); // {} {fqn} {cache}
584 lua_pushvalue( L, -1); // {} {fqn} {cache} {cache} 582 REGISTRY_SET( L, LOOKUPCACHE_REGKEY, lua_pushvalue( L, -2));
585 lua_setfield( L, LUA_REGISTRYINDEX, LOOKUP_KEY_CACHE); // {} {fqn} {cache} 583 STACK_MID( L, 3);
586 } 584 }
587 // process everything we find in that table, filling in lookup data for all functions and tables we see there 585 // process everything we find in that table, filling in lookup data for all functions and tables we see there
588 populate_func_lookup_table_recur( DEBUGSPEW_PARAM_COMMA( U) L, ctx_base, in_base, start_depth); 586 populate_func_lookup_table_recur( DEBUGSPEW_PARAM_COMMA( U) L, ctx_base, in_base, start_depth);