aboutsummaryrefslogtreecommitdiff
path: root/src/deep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/deep.cpp')
-rw-r--r--src/deep.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/deep.cpp b/src/deep.cpp
index 0fdcb31..b6a9a22 100644
--- a/src/deep.cpp
+++ b/src/deep.cpp
@@ -70,7 +70,7 @@ namespace {
70 */ 70 */
71 [[nodiscard]] static int DeepGC(lua_State* const L_) 71 [[nodiscard]] static int DeepGC(lua_State* const L_)
72 { 72 {
73 DeepPrelude* const* const _proxy{ lua_tofulluserdata<DeepPrelude*>(L_, 1) }; 73 DeepPrelude* const* const _proxy{ luaG_tofulluserdata<DeepPrelude*>(L_, 1) };
74 DeepPrelude* const _p{ *_proxy }; 74 DeepPrelude* const _p{ *_proxy };
75 75
76 // can work without a universe if creating a deep userdata from some external C module when Lanes isn't loaded 76 // can work without a universe if creating a deep userdata from some external C module when Lanes isn't loaded
@@ -135,7 +135,7 @@ void DeepFactory::DeleteDeepObject(lua_State* const L_, DeepPrelude* const o_)
135{ 135{
136 // when looking inside a keeper, we are 100% sure the object is a deep userdata 136 // when looking inside a keeper, we are 100% sure the object is a deep userdata
137 if (mode_ == LookupMode::FromKeeper) { 137 if (mode_ == LookupMode::FromKeeper) {
138 DeepPrelude* const _proxy{ *lua_tofulluserdata<DeepPrelude*>(L_, index_) }; 138 DeepPrelude* const _proxy{ *luaG_tofulluserdata<DeepPrelude*>(L_, index_) };
139 // we can (and must) cast and fetch the internally stored factory 139 // we can (and must) cast and fetch the internally stored factory
140 return &_proxy->factory; 140 return &_proxy->factory;
141 } else { 141 } else {
@@ -152,7 +152,7 @@ void DeepFactory::DeleteDeepObject(lua_State* const L_, DeepPrelude* const o_)
152 // replace metatable with the factory pointer, if it is actually a deep userdata 152 // replace metatable with the factory pointer, if it is actually a deep userdata
153 LookupDeep(L_); // L_: deep ... factory|nil 153 LookupDeep(L_); // L_: deep ... factory|nil
154 154
155 DeepFactory* const _ret{ lua_tolightuserdata<DeepFactory>(L_, -1) }; // nullptr if not a userdata 155 DeepFactory* const _ret{ luaG_tolightuserdata<DeepFactory>(L_, -1) }; // nullptr if not a userdata
156 lua_pop(L_, 1); 156 lua_pop(L_, 1);
157 STACK_CHECK(L_, 0); 157 STACK_CHECK(L_, 0);
158 return _ret; 158 return _ret;
@@ -188,7 +188,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_,
188 STACK_GROW(L_, 7); 188 STACK_GROW(L_, 7);
189 189
190 // a new full userdata, fitted with the specified number of uservalue slots (always 1 for Lua < 5.4) 190 // a new full userdata, fitted with the specified number of uservalue slots (always 1 for Lua < 5.4)
191 DeepPrelude** const _proxy{ lua_newuserdatauv<DeepPrelude*>(L_, nuv_) }; // L_: DPC proxy 191 DeepPrelude** const _proxy{ luaG_newuserdatauv<DeepPrelude*>(L_, nuv_) }; // L_: DPC proxy
192 LUA_ASSERT(L_, _proxy); 192 LUA_ASSERT(L_, _proxy);
193 *_proxy = prelude_; 193 *_proxy = prelude_;
194 prelude_->refcount.fetch_add(1, std::memory_order_relaxed); // one more proxy pointing to this deep data 194 prelude_->refcount.fetch_add(1, std::memory_order_relaxed); // one more proxy pointing to this deep data
@@ -237,7 +237,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_,
237 raise_luaL_error(errL_, "lanes receiving deep userdata should register the 'package' library"); 237 raise_luaL_error(errL_, "lanes receiving deep userdata should register the 'package' library");
238 } 238 }
239 239
240 std::ignore = luaG_pushstringview(L_, _modname); // L_: DPC proxy metatable require() "module" 240 std::ignore = luaG_pushstring(L_, _modname); // L_: DPC proxy metatable require() "module"
241 if (luaG_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED 241 if (luaG_getfield(L_, LUA_REGISTRYINDEX, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED
242 // no L.registry._LOADED; can this ever happen? 242 // no L.registry._LOADED; can this ever happen?
243 lua_pop(L_, 6); // L_: 243 lua_pop(L_, 6); // L_:
@@ -256,7 +256,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_,
256 LuaError const _require_result{ lua_pcall(L_, 1, 0, 0) }; // L_: DPC proxy metatable error? 256 LuaError const _require_result{ lua_pcall(L_, 1, 0, 0) }; // L_: DPC proxy metatable error?
257 if (_require_result != LuaError::OK) { 257 if (_require_result != LuaError::OK) {
258 // failed, raise the error in the proper state 258 // failed, raise the error in the proper state
259 raise_luaL_error(errL_, luaG_tostringview(L_, -1)); 259 raise_luaL_error(errL_, luaG_tostring(L_, -1));
260 } 260 }
261 } 261 }
262 } else { // already loaded, we are happy 262 } else { // already loaded, we are happy
@@ -368,7 +368,7 @@ DeepPrelude* DeepFactory::toDeep(lua_State* const L_, int const index_) const
368 } 368 }
369 STACK_CHECK(L_, 0); 369 STACK_CHECK(L_, 0);
370 370
371 DeepPrelude** const _proxy{ lua_tofulluserdata<DeepPrelude*>(L_, index_) }; 371 DeepPrelude** const _proxy{ luaG_tofulluserdata<DeepPrelude*>(L_, index_) };
372 return *_proxy; 372 return *_proxy;
373} 373}
374 374