aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r--src/lanes.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp
index cf443f2..3d0c70d 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -1027,7 +1027,7 @@ LUAG_FUNC(lane_new)
1027 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed)); 1027 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed));
1028 1028
1029 // populate with selected libraries at the same time 1029 // populate with selected libraries at the same time
1030 lua_State* const L2{ luaG_newstate(U, L, libs_str) }; // L // L2 1030 lua_State* const L2{ luaG_newstate(U, Source{ L }, libs_str) }; // L // L2
1031 1031
1032 // 'lane' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread) 1032 // 'lane' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread)
1033 Lane* const lane{ new (U) Lane{ U, L2 } }; 1033 Lane* const lane{ new (U) Lane{ U, L2 } };
@@ -1134,7 +1134,7 @@ LUAG_FUNC(lane_new)
1134 { 1134 {
1135 DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "lane_new: update 'package'\n" INDENT_END)); 1135 DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "lane_new: update 'package'\n" INDENT_END));
1136 // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack 1136 // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack
1137 (void) luaG_inter_copy_package(U, L, L2, package_idx, LookupMode::LaneBody); 1137 std::ignore = luaG_inter_copy_package(U, Source{ L }, Dest{ L2 }, package_idx, LookupMode::LaneBody);
1138 } 1138 }
1139 1139
1140 // modules to require in the target lane *before* the function is transfered! 1140 // modules to require in the target lane *before* the function is transfered!
@@ -1150,7 +1150,7 @@ LUAG_FUNC(lane_new)
1150 } 1150 }
1151 1151
1152 lua_pushnil(L); // func libs priority globals package required gc_cb [... args ...] nil 1152 lua_pushnil(L); // func libs priority globals package required gc_cb [... args ...] nil
1153 while( lua_next(L, required_idx) != 0) // func libs priority globals package required gc_cb [... args ...] n "modname" 1153 while (lua_next(L, required_idx) != 0) // func libs priority globals package required gc_cb [... args ...] n "modname"
1154 { 1154 {
1155 if (lua_type(L, -1) != LUA_TSTRING || lua_type(L, -2) != LUA_TNUMBER || lua_tonumber(L, -2) != nbRequired) 1155 if (lua_type(L, -1) != LUA_TSTRING || lua_type(L, -2) != LUA_TNUMBER || lua_tonumber(L, -2) != nbRequired)
1156 { 1156 {
@@ -1176,7 +1176,7 @@ LUAG_FUNC(lane_new)
1176 if (lua_pcall( L2, 1, 1, 0) != LUA_OK) // ret/errcode 1176 if (lua_pcall( L2, 1, 1, 0) != LUA_OK) // ret/errcode
1177 { 1177 {
1178 // propagate error to main state if any 1178 // propagate error to main state if any
1179 luaG_inter_move(U, L2, L, 1, LookupMode::LaneBody); // func libs priority globals package required gc_cb [... args ...] n "modname" error 1179 luaG_inter_move(U, Source{ L2 }, Dest{ L }, 1, LookupMode::LaneBody); // func libs priority globals package required gc_cb [... args ...] n "modname" error
1180 raise_lua_error(L); 1180 raise_lua_error(L);
1181 } 1181 }
1182 // after requiring the module, register the functions it exported in our name<->function database 1182 // after requiring the module, register the functions it exported in our name<->function database
@@ -1209,7 +1209,7 @@ LUAG_FUNC(lane_new)
1209 lua_pushglobaltable(L2); // _G 1209 lua_pushglobaltable(L2); // _G
1210 while( lua_next(L, globals_idx)) // func libs priority globals package required gc_cb [... args ...] k v 1210 while( lua_next(L, globals_idx)) // func libs priority globals package required gc_cb [... args ...] k v
1211 { 1211 {
1212 luaG_inter_copy(U, L, L2, 2, LookupMode::LaneBody); // _G k v 1212 luaG_inter_copy(U, Source{ L }, Dest{ L2 }, 2, LookupMode::LaneBody); // _G k v
1213 // assign it in L2's globals table 1213 // assign it in L2's globals table
1214 lua_rawset(L2, -3); // _G 1214 lua_rawset(L2, -3); // _G
1215 lua_pop(L, 1); // func libs priority globals package required gc_cb [... args ...] k 1215 lua_pop(L, 1); // func libs priority globals package required gc_cb [... args ...] k
@@ -1227,7 +1227,7 @@ LUAG_FUNC(lane_new)
1227 DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane body\n" INDENT_END)); 1227 DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane body\n" INDENT_END));
1228 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed)); 1228 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed));
1229 lua_pushvalue(L, 1); // func libs priority globals package required gc_cb [... args ...] func 1229 lua_pushvalue(L, 1); // func libs priority globals package required gc_cb [... args ...] func
1230 int const res{ luaG_inter_move(U, L, L2, 1, LookupMode::LaneBody) };// func libs priority globals package required gc_cb [... args ...] // func 1230 int const res{ luaG_inter_move(U, Source{ L }, Dest{ L2 }, 1, LookupMode::LaneBody) }; // func libs priority globals package required gc_cb [... args ...] // func
1231 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed)); 1231 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed));
1232 if (res != 0) 1232 if (res != 0)
1233 { 1233 {
@@ -1253,7 +1253,7 @@ LUAG_FUNC(lane_new)
1253 int res; 1253 int res;
1254 DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane arguments\n" INDENT_END)); 1254 DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane arguments\n" INDENT_END));
1255 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed)); 1255 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_add(1, std::memory_order_relaxed));
1256 res = luaG_inter_move(U, L, L2, nargs, LookupMode::LaneBody); // func libs priority globals package required gc_cb // func [... args ...] 1256 res = luaG_inter_move(U, Source{ L }, Dest{ L2 }, nargs, LookupMode::LaneBody); // func libs priority globals package required gc_cb // func [... args ...]
1257 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed)); 1257 DEBUGSPEW_CODE(U->debugspew_indent_depth.fetch_sub(1, std::memory_order_relaxed));
1258 if (res != 0) 1258 if (res != 0)
1259 { 1259 {
@@ -1418,7 +1418,7 @@ LUAG_FUNC(thread_join)
1418 case Lane::Done: 1418 case Lane::Done:
1419 { 1419 {
1420 int const n{ lua_gettop(L2) }; // whole L2 stack 1420 int const n{ lua_gettop(L2) }; // whole L2 stack
1421 if ((n > 0) && (luaG_inter_move(U, L2, L, n, LookupMode::LaneBody) != 0)) 1421 if ((n > 0) && (luaG_inter_move(U, Source{ L2 }, Dest{ L }, n, LookupMode::LaneBody) != 0))
1422 { 1422 {
1423 return luaL_error(L, "tried to copy unsupported types"); 1423 return luaL_error(L, "tried to copy unsupported types");
1424 } 1424 }
@@ -1432,7 +1432,7 @@ LUAG_FUNC(thread_join)
1432 STACK_GROW(L, 3); 1432 STACK_GROW(L, 3);
1433 lua_pushnil(L); 1433 lua_pushnil(L);
1434 // even when ERROR_FULL_STACK, if the error is not LUA_ERRRUN, the handler wasn't called, and we only have 1 error message on the stack ... 1434 // even when ERROR_FULL_STACK, if the error is not LUA_ERRRUN, the handler wasn't called, and we only have 1 error message on the stack ...
1435 if (luaG_inter_move(U, L2, L, n, LookupMode::LaneBody) != 0) // nil "err" [trace] 1435 if (luaG_inter_move(U, Source{ L2 }, Dest{ L }, n, LookupMode::LaneBody) != 0) // nil "err" [trace]
1436 { 1436 {
1437 return luaL_error(L, "tried to copy unsupported types: %s", lua_tostring(L, -n)); 1437 return luaL_error(L, "tried to copy unsupported types: %s", lua_tostring(L, -n));
1438 } 1438 }
@@ -1832,7 +1832,7 @@ LUAG_FUNC(configure)
1832 STACK_CHECK(L, 2); 1832 STACK_CHECK(L, 2);
1833 1833
1834 { 1834 {
1835 char const* errmsg{ push_deep_proxy(L, U->timer_deep, 0, LookupMode::LaneBody) }; // settings M timer_deep 1835 char const* errmsg{ push_deep_proxy(Dest{ L }, U->timer_deep, 0, LookupMode::LaneBody) }; // settings M timer_deep
1836 if (errmsg != nullptr) 1836 if (errmsg != nullptr)
1837 { 1837 {
1838 return luaL_error(L, errmsg); 1838 return luaL_error(L, errmsg);