aboutsummaryrefslogtreecommitdiff
path: root/src/deep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/deep.cpp')
-rw-r--r--src/deep.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/deep.cpp b/src/deep.cpp
index 74ecfb8..652b19d 100644
--- a/src/deep.cpp
+++ b/src/deep.cpp
@@ -32,21 +32,22 @@ THE SOFTWARE.
32=============================================================================== 32===============================================================================
33*/ 33*/
34 34
35#include "compat.h"
36#include "deep.h"
37#include "tools.h"
38#include "uniquekey.h"
39#include "universe.h"
40
41#include <bit>
42#include <cassert>
43#include <ctype.h>
35#include <stdio.h> 44#include <stdio.h>
36#include <assert.h>
37#include <string.h> 45#include <string.h>
38#include <ctype.h>
39#include <stdlib.h> 46#include <stdlib.h>
40#if !defined(__APPLE__) 47#if !defined(__APPLE__)
41#include <malloc.h> 48#include <malloc.h>
42#endif 49#endif
43 50
44#include "compat.h"
45#include "deep.h"
46#include "tools.h"
47#include "universe.h"
48#include "uniquekey.h"
49
50/*-- Metatable copying --*/ 51/*-- Metatable copying --*/
51 52
52/*---=== Deep userdata ===---*/ 53/*---=== Deep userdata ===---*/
@@ -227,7 +228,7 @@ char const* push_deep_proxy(lua_State* L, DeepPrelude* prelude, int nuv_, Lookup
227 prelude->m_refcount.fetch_add(1, std::memory_order_relaxed); // one more proxy pointing to this deep data 228 prelude->m_refcount.fetch_add(1, std::memory_order_relaxed); // one more proxy pointing to this deep data
228 229
229 // Get/create metatable for 'idfunc' (in this state) 230 // Get/create metatable for 'idfunc' (in this state)
230 lua_pushlightuserdata( L, (void*)(ptrdiff_t)(prelude->idfunc)); // DPC proxy idfunc 231 lua_pushlightuserdata( L, std::bit_cast<void*>(prelude->idfunc)); // DPC proxy idfunc
231 get_deep_lookup( L); // DPC proxy metatable? 232 get_deep_lookup( L); // DPC proxy metatable?
232 233
233 if( lua_isnil( L, -1)) // // No metatable yet. 234 if( lua_isnil( L, -1)) // // No metatable yet.
@@ -269,7 +270,7 @@ char const* push_deep_proxy(lua_State* L, DeepPrelude* prelude, int nuv_, Lookup
269 270
270 // Memorize for later rounds 271 // Memorize for later rounds
271 lua_pushvalue( L, -1); // DPC proxy metatable metatable 272 lua_pushvalue( L, -1); // DPC proxy metatable metatable
272 lua_pushlightuserdata( L, (void*)(ptrdiff_t)(prelude->idfunc)); // DPC proxy metatable metatable idfunc 273 lua_pushlightuserdata( L, std::bit_cast<void*>(prelude->idfunc)); // DPC proxy metatable metatable idfunc
273 set_deep_lookup( L); // DPC proxy metatable 274 set_deep_lookup( L); // DPC proxy metatable
274 275
275 // 2 - cause the target state to require the module that exported the idfunc 276 // 2 - cause the target state to require the module that exported the idfunc