update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -7,7 +7,7 @@
#ifndef BOOST_CONTEXT_CONTINUATION_H
#define BOOST_CONTEXT_CONTINUATION_H
#include <boost/predef.h>
#include <boost/predef/os.h>
#if BOOST_OS_MACOS
#define _XOPEN_SOURCE 600
#endif
@@ -16,6 +16,7 @@ extern "C" {
#include <ucontext.h>
}
#include <boost/predef.h>
#include <boost/context/detail/config.hpp>
#include <algorithm>
@@ -60,12 +61,19 @@ namespace detail {
// tampoline function
// entered if the execution context
// is resumed for the first time
template< typename Record >
static void entry_func( void * data) noexcept {
Record * record = static_cast< Record * >( data);
BOOST_ASSERT( nullptr != record);
// start execution of toplevel context-function
record->run();
template <typename Record>
#ifdef BOOST_OS_MACOS
static void entry_func(std::uint32_t data_high,
std::uint32_t data_low) noexcept {
auto data =
reinterpret_cast<void *>(std::uint64_t(data_high) << 32 | data_low);
#else
static void entry_func(void *data) noexcept {
#endif
Record *record = static_cast<Record *>(data);
BOOST_ASSERT(nullptr != record);
// start execution of toplevel context-function
record->run();
}
struct BOOST_CONTEXT_DECL activation_record {
@@ -210,19 +218,10 @@ struct BOOST_CONTEXT_DECL activation_record_initializer {
struct forced_unwind {
activation_record * from{ nullptr };
#ifndef BOOST_ASSERT_IS_VOID
bool caught{ false };
#endif
forced_unwind( activation_record * from_) noexcept :
from{ from_ } {
}
#ifndef BOOST_ASSERT_IS_VOID
~forced_unwind() {
BOOST_ASSERT( caught);
}
#endif
};
template< typename Ctx, typename StackAlloc, typename Fn >
@@ -268,9 +267,6 @@ public:
#endif
} catch ( forced_unwind const& ex) {
c = Ctx{ ex.from };
#ifndef BOOST_ASSERT_IS_VOID
const_cast< forced_unwind & >( ex).caught = true;
#endif
}
// this context has finished its task
from = nullptr;
@@ -310,7 +306,15 @@ static activation_record * create_context1( StackAlloc && salloc, Fn && fn) {
record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) -
reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64);
record->uctx.uc_link = nullptr;
::makecontext( & record->uctx, ( void (*)() ) & entry_func< capture_t >, 1, record);
#ifdef BOOST_OS_MACOS
const auto integer = std::uint64_t(record);
::makecontext(&record->uctx, (void (*)()) & entry_func<capture_t>, 2,
std::uint32_t((integer >> 32) & 0xFFFFFFFF),
std::uint32_t(integer));
#else
::makecontext(&record->uctx, (void (*)()) & entry_func<capture_t>, 1,
record);
#endif
#if defined(BOOST_USE_ASAN)
record->stack_bottom = record->uctx.uc_stack.ss_sp;
record->stack_size = record->uctx.uc_stack.ss_size;
@@ -345,7 +349,15 @@ static activation_record * create_context2( preallocated palloc, StackAlloc && s
record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) -
reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64);
record->uctx.uc_link = nullptr;
::makecontext( & record->uctx, ( void (*)() ) & entry_func< capture_t >, 1, record);
#ifdef BOOST_OS_MACOS
const auto integer = std::uint64_t(record);
::makecontext(&record->uctx, (void (*)()) & entry_func<capture_t>, 2,
std::uint32_t((integer >> 32) & 0xFFFFFFFF),
std::uint32_t(integer));
#else
::makecontext(&record->uctx, (void (*)()) & entry_func<capture_t>, 1,
record);
#endif
#if defined(BOOST_USE_ASAN)
record->stack_bottom = record->uctx.uc_stack.ss_sp;
record->stack_size = record->uctx.uc_stack.ss_size;
@@ -465,6 +477,8 @@ public:
return ptr_ < other.ptr_;
}
#if !defined(BOOST_EMBTC)
template< typename charT, class traitsT >
friend std::basic_ostream< charT, traitsT > &
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) {
@@ -475,11 +489,33 @@ public:
}
}
#else
template< typename charT, class traitsT >
friend std::basic_ostream< charT, traitsT > &
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other);
#endif
void swap( continuation & other) noexcept {
std::swap( ptr_, other.ptr_);
}
};
#if defined(BOOST_EMBTC)
template< typename charT, class traitsT >
inline std::basic_ostream< charT, traitsT > &
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) {
if ( nullptr != other.ptr_) {
return os << other.ptr_;
} else {
return os << "{not-a-context}";
}
}
#endif
template<
typename Fn,
typename = detail::disable_overload< continuation, Fn >