diff options
Diffstat (limited to 'src/deep.cpp')
-rw-r--r-- | src/deep.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/deep.cpp b/src/deep.cpp index 241cb95..d7efe68 100644 --- a/src/deep.cpp +++ b/src/deep.cpp | |||
@@ -53,14 +53,14 @@ THE SOFTWARE. | |||
53 | * metatable -> factory | 53 | * metatable -> factory |
54 | * factory -> metatable | 54 | * factory -> metatable |
55 | */ | 55 | */ |
56 | // crc64/we of string "DEEP_LOOKUP_KEY" generated at http://www.nitrxgen.net/hashgen/ | 56 | // xxh64 of string "kDeepLookupRegKey" generated at https://www.pelock.com/products/hash-calculator |
57 | static constexpr RegistryUniqueKey DEEP_LOOKUP_KEY{ 0x9FB9B4F3F633D83Dull }; | 57 | static constexpr RegistryUniqueKey kDeepLookupRegKey{ 0xC6788345703C6059ull }; |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * The deep proxy cache is a weak valued table listing all deep UD proxies indexed by the deep UD that they are proxying | 60 | * The deep proxy cache is a weak valued table listing all deep UD proxies indexed by the deep UD that they are proxying |
61 | * crc64/we of string "DEEP_PROXY_CACHE_KEY" generated at http://www.nitrxgen.net/hashgen/ | 61 | * xxh64 of string "kDeepProxyCacheRegKey" generated at https://www.pelock.com/products/hash-calculator |
62 | */ | 62 | */ |
63 | static constexpr RegistryUniqueKey DEEP_PROXY_CACHE_KEY{ 0x05773D6FC26BE106ull }; | 63 | static constexpr RegistryUniqueKey kDeepProxyCacheRegKey{ 0xEBCD49AE1A3DD35Eull }; |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * Sets up [-1]<->[-2] two-way lookups, and ensures the lookup table exists. | 66 | * Sets up [-1]<->[-2] two-way lookups, and ensures the lookup table exists. |
@@ -70,7 +70,7 @@ static void set_deep_lookup(lua_State* L) | |||
70 | { | 70 | { |
71 | STACK_GROW( L, 3); | 71 | STACK_GROW( L, 3); |
72 | STACK_CHECK_START_REL(L, 2); // a b | 72 | STACK_CHECK_START_REL(L, 2); // a b |
73 | push_registry_subtable( L, DEEP_LOOKUP_KEY); // a b {} | 73 | push_registry_subtable( L, kDeepLookupRegKey); // a b {} |
74 | STACK_CHECK( L, 3); | 74 | STACK_CHECK( L, 3); |
75 | lua_insert( L, -3); // {} a b | 75 | lua_insert( L, -3); // {} a b |
76 | lua_pushvalue( L, -1); // {} a b b | 76 | lua_pushvalue( L, -1); // {} a b b |
@@ -91,7 +91,7 @@ static void get_deep_lookup(lua_State* L) | |||
91 | { | 91 | { |
92 | STACK_GROW( L, 1); | 92 | STACK_GROW( L, 1); |
93 | STACK_CHECK_START_REL(L, 1); // a | 93 | STACK_CHECK_START_REL(L, 1); // a |
94 | DEEP_LOOKUP_KEY.pushValue(L); // a {} | 94 | kDeepLookupRegKey.pushValue(L); // a {} |
95 | if (!lua_isnil( L, -1)) | 95 | if (!lua_isnil( L, -1)) |
96 | { | 96 | { |
97 | lua_insert( L, -2); // {} a | 97 | lua_insert( L, -2); // {} a |
@@ -194,7 +194,7 @@ void DeepFactory::DeleteDeepObject(lua_State* L, DeepPrelude* o_) | |||
194 | char const* DeepFactory::PushDeepProxy(DestState L, DeepPrelude* prelude, int nuv_, LookupMode mode_) | 194 | char const* DeepFactory::PushDeepProxy(DestState L, DeepPrelude* prelude, int nuv_, LookupMode mode_) |
195 | { | 195 | { |
196 | // Check if a proxy already exists | 196 | // Check if a proxy already exists |
197 | push_registry_subtable_mode(L, DEEP_PROXY_CACHE_KEY, "v"); // DPC | 197 | push_registry_subtable_mode(L, kDeepProxyCacheRegKey, "v"); // DPC |
198 | lua_pushlightuserdata(L, prelude); // DPC deep | 198 | lua_pushlightuserdata(L, prelude); // DPC deep |
199 | lua_rawget(L, -2); // DPC proxy | 199 | lua_rawget(L, -2); // DPC proxy |
200 | if (!lua_isnil(L, -1)) | 200 | if (!lua_isnil(L, -1)) |
@@ -354,11 +354,11 @@ int DeepFactory::pushDeepUserdata(DestState L, int nuv_) const | |||
354 | return luaL_error( L, "DeepFactory::newDeepObjectInternal failed to create deep userdata (out of memory)"); | 354 | return luaL_error( L, "DeepFactory::newDeepObjectInternal failed to create deep userdata (out of memory)"); |
355 | } | 355 | } |
356 | 356 | ||
357 | if (prelude->m_magic != DEEP_VERSION) | 357 | if (prelude->m_magic != kDeepVersion) |
358 | { | 358 | { |
359 | // just in case, don't leak the newly allocated deep userdata object | 359 | // just in case, don't leak the newly allocated deep userdata object |
360 | deleteDeepObjectInternal(L, prelude); | 360 | deleteDeepObjectInternal(L, prelude); |
361 | return luaL_error( L, "Bad Deep Factory: DEEP_VERSION is incorrect, rebuild your implementation with the latest deep implementation"); | 361 | return luaL_error( L, "Bad Deep Factory: kDeepVersion is incorrect, rebuild your implementation with the latest deep implementation"); |
362 | } | 362 | } |
363 | 363 | ||
364 | LUA_ASSERT(L, prelude->m_refcount.load(std::memory_order_relaxed) == 0); // 'DeepFactory::PushDeepProxy' will lift it to 1 | 364 | LUA_ASSERT(L, prelude->m_refcount.load(std::memory_order_relaxed) == 0); // 'DeepFactory::PushDeepProxy' will lift it to 1 |