boost/boost-ppc64-abiv2-coroutine.patch

81 lines
2.7 KiB
Diff

diff --git a/boost/coroutine/detail/coroutine_context.hpp b/boost/coroutine/detail/coroutine_context.hpp
--- a/boost/coroutine/detail/coroutine_context.hpp
+++ b/boost/coroutine/detail/coroutine_context.hpp
@@ -34,27 +34,33 @@ namespace boost {
namespace coroutines {
namespace detail {
-
-class BOOST_COROUTINES_DECL coroutine_context : private context::fcontext_t,
- private stack_context
+// class hold stack-context and coroutines execution-context
+class BOOST_COROUTINES_DECL coroutine_context
{
private:
- stack_context * stack_ctx_;
- context::fcontext_t * ctx_;
+ stack_context stack_ctx_;
+ context::fcontext_t *ctx_;
public:
typedef void( * ctx_fn)( intptr_t);
+ // default ctor represents the current execution-context
coroutine_context();
- explicit coroutine_context( ctx_fn, stack_context *);
+ // ctor creates a new execution-context running coroutine-fn `fn`
+ // `ctx_` will be allocated on top of the stack managed by parameter
+ // `stack_ctx`
+ coroutine_context( ctx_fn fn, stack_context const& stack_ctx);
coroutine_context( coroutine_context const&);
coroutine_context& operator=( coroutine_context const&);
intptr_t jump( coroutine_context &, intptr_t = 0, bool = true);
+
+ stack_context & stack_ctx()
+ { return stack_ctx_; }
};
}}}
diff --git a/libs/coroutine/src/detail/coroutine_context.cpp b/libs/coroutine/src/detail/coroutine_context.cpp
--- a/libs/coroutine/src/detail/coroutine_context.cpp
+++ b/libs/coroutine/src/detail/coroutine_context.cpp
@@ -34,20 +34,20 @@ namespace coroutines {
namespace detail {
coroutine_context::coroutine_context() :
- fcontext_t(), stack_ctx_( this), ctx_( this)
+ stack_ctx_(),
+ ctx_( 0)
{
#if defined(BOOST_USE_SEGMENTED_STACKS)
__splitstack_getcontext( stack_ctx_->segments_ctx);
#endif
}
-coroutine_context::coroutine_context( ctx_fn fn, stack_context * stack_ctx) :
- fcontext_t(), stack_ctx_( stack_ctx),
- ctx_( context::make_fcontext( stack_ctx_->sp, stack_ctx_->size, fn) )
+coroutine_context::coroutine_context( ctx_fn fn, stack_context const& stack_ctx) :
+ stack_ctx_( stack_ctx),
+ ctx_( context::make_fcontext( stack_ctx_.sp, stack_ctx_.size, fn) )
{}
coroutine_context::coroutine_context( coroutine_context const& other) :
- fcontext_t(),
stack_ctx_( other.stack_ctx_),
ctx_( other.ctx_)
{}
@@ -79,7 +79,7 @@ coroutine_context::jump( coroutine_context & other, intptr_t param, bool preserv
return ret;
#else
- return context::jump_fcontext( ctx_, other.ctx_, param, preserve_fpu);
+ return context::jump_fcontext( & ctx_, other.ctx_, param, preserve_fpu);
#endif
}