mirror of
https://github.com/boostorg/context.git
synced 2026-01-26 06:22:42 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -23,9 +23,6 @@ namespace boost {
|
||||
namespace context {
|
||||
namespace detail {
|
||||
|
||||
#if _MSC_VER > 1800
|
||||
using std::invoke;
|
||||
#else
|
||||
template< typename Fn, typename ... Args >
|
||||
typename std::enable_if<
|
||||
std::is_member_pointer< typename std::decay< Fn >::type >::value,
|
||||
@@ -43,7 +40,6 @@ typename std::enable_if<
|
||||
invoke( Fn && fn, Args && ... args) {
|
||||
return std::forward< Fn >( fn)( std::forward< Args >( args) ... );
|
||||
}
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
#include <boost/context/detail/apply.hpp>
|
||||
#endif
|
||||
#include <boost/context/detail/disable_overload.hpp>
|
||||
#include <boost/context/detail/fcontext.hpp>
|
||||
#include <boost/context/fixedsize_stack.hpp>
|
||||
@@ -157,7 +159,11 @@ transfer_t context_ontop( transfer_t t) {
|
||||
BOOST_ASSERT( nullptr != tpl);
|
||||
auto data = std::get< 0 >( * tpl);
|
||||
typename std::decay< Fn >::type fn = std::forward< Fn >( std::get< 1 >( * tpl) );
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
dp->data = apply( fn, std::tie( data) );
|
||||
#else
|
||||
dp->data = std::apply( fn, std::tie( data) );
|
||||
#endif
|
||||
return { t.fctx, dp };
|
||||
}
|
||||
|
||||
@@ -196,7 +202,11 @@ public:
|
||||
|
||||
void run() {
|
||||
auto data = caller_->resume( nullptr);
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
apply( fn_, std::tuple_cat( args_, std::tie( data) ) );
|
||||
#else
|
||||
std::apply( fn_, std::tuple_cat( args_, std::tie( data) ) );
|
||||
#endif
|
||||
BOOST_ASSERT_MSG( ! main_ctx, "main-context does not execute activation-record::run()");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
#include <boost/context/detail/apply.hpp>
|
||||
#endif
|
||||
#include <boost/context/detail/disable_overload.hpp>
|
||||
#include <boost/context/detail/exception.hpp>
|
||||
#include <boost/context/detail/exchange.hpp>
|
||||
@@ -107,7 +109,11 @@ public:
|
||||
std::forward_as_tuple( std::move( from) ),
|
||||
std::move( args) );
|
||||
// invoke context-function
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
Ctx cc = apply( std::move( fn_), std::move( tpl) );
|
||||
#else
|
||||
Ctx cc = std::apply( std::move( fn_), std::move( tpl) );
|
||||
#endif
|
||||
return { exchange( cc.fctx_, nullptr), nullptr };
|
||||
}
|
||||
};
|
||||
@@ -392,7 +398,11 @@ transfer_t context_ontop( transfer_t t) {
|
||||
auto args = std::move( std::get< 1 >( std::get< 1 >( * p) ) );
|
||||
try {
|
||||
// execute function
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
std::get< 1 >( std::get< 1 >( * p) ) = helper< sizeof ... (Args) >::convert( apply( fn, std::move( args) ) );
|
||||
#else
|
||||
std::get< 1 >( std::get< 1 >( * p) ) = helper< sizeof ... (Args) >::convert( std::apply( fn, std::move( args) ) );
|
||||
#endif
|
||||
} catch (...) {
|
||||
std::get< 0 >( std::get< 1 >( * p) ) = std::current_exception();
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ public:
|
||||
transfer_t run( transfer_t t) {
|
||||
Ctx from{ t.fctx };
|
||||
// invoke context-function
|
||||
Ctx cc = apply(
|
||||
fn_,
|
||||
std::tuple_cat(
|
||||
params_,
|
||||
std::forward_as_tuple( std::move( from) ) ) );
|
||||
#if defined(BOOST_NO_CXX17_STD_APPLY)
|
||||
Ctx cc = apply( fn_, std::tuple_cat( params_, std::forward_as_tuple( std::move( from) ) ) );
|
||||
#else
|
||||
Ctx cc = std::apply( fn_, std::tuple_cat( params_, std::forward_as_tuple( std::move( from) ) ) );
|
||||
#endif
|
||||
return { exchange( cc.fctx_, nullptr), nullptr };
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -67,11 +67,11 @@ trampoline:
|
||||
/* fix stack alignment */
|
||||
push %rbp
|
||||
/* jump to context-function */
|
||||
jmp %rbx
|
||||
jmp *%rbx
|
||||
|
||||
finish:
|
||||
/* exit code is zero */
|
||||
xorq %rdi, %rdi
|
||||
/* exit application */
|
||||
call _exit@PLT
|
||||
call __exit
|
||||
hlt
|
||||
|
||||
Reference in New Issue
Block a user