aboutsummaryrefslogtreecommitdiff
path: root/src/universe.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/universe.h')
-rw-r--r--src/universe.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/universe.h b/src/universe.h
index 47b86af..3742ddd 100644
--- a/src/universe.h
+++ b/src/universe.h
@@ -18,6 +18,9 @@ class Lane;
18class AllocatorDefinition 18class AllocatorDefinition
19{ 19{
20 public: 20 public:
21 // xxh64 of string "kAllocatorVersion_1" generated at https://www.pelock.com/products/hash-calculator
22 static constexpr uintptr_t kAllocatorVersion{ static_cast<uintptr_t>(0xCF9D321B0DFB5715ull) };
23 uintptr_t version{ kAllocatorVersion };
21 lua_Alloc allocF{ nullptr }; 24 lua_Alloc allocF{ nullptr };
22 void* allocUD{ nullptr }; 25 void* allocUD{ nullptr };
23 26
@@ -27,8 +30,9 @@ class AllocatorDefinition
27 // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception 30 // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception
28 static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] lua_State* L_) { LUA_ASSERT(L_, !"should never be called"); } 31 static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] lua_State* L_) { LUA_ASSERT(L_, !"should never be called"); }
29 32
30 AllocatorDefinition(lua_Alloc allocF_, void* allocUD_) noexcept 33 AllocatorDefinition(uintptr_t const version_, lua_Alloc const allocF_, void* const allocUD_) noexcept
31 : allocF{ allocF_ } 34 : version{ version_ }
35 , allocF{ allocF_ }
32 , allocUD{ allocUD_ } 36 , allocUD{ allocUD_ }
33 { 37 {
34 } 38 }
@@ -77,7 +81,7 @@ class ProtectedAllocator
77 81
78 AllocatorDefinition makeDefinition() 82 AllocatorDefinition makeDefinition()
79 { 83 {
80 return AllocatorDefinition{ protected_lua_Alloc, this }; 84 return AllocatorDefinition{ version, protected_lua_Alloc, this };
81 } 85 }
82 86
83 void installIn(lua_State* L_) 87 void installIn(lua_State* L_)