@@ -30,7 +30,6 @@ namespace exec::__system_context_default_impl {
3030 using system_context_replaceability::receiver;
3131 using system_context_replaceability::bulk_item_receiver;
3232 using system_context_replaceability::storage;
33- using system_context_replaceability::env;
3433 using system_context_replaceability::system_scheduler;
3534 using system_context_replaceability::__system_context_backend_factory;
3635
@@ -45,20 +44,18 @@ namespace exec::__system_context_default_impl {
4544 - __recv::__r_ (receiver*) -- 8
4645 - __recv::__op_ (__operation*) -- 8
4746 - __operation::__inner_op_ (stdexec::connect_result_t<_Sender, __recv<_Sender>>) -- 56 (when connected with an empty receiver)
48- - __operation::__stop_token_ (inplace_stop_token) -- 8
4947 - __operation::__on_heap_ (bool) -- optimized away
5048 ---------------------
51- Total: 80 ; extra 24 bytes compared to internal operation state.
49+ Total: 72 ; extra 16 bytes compared to internal operation state.
5250
5351 extra for bulk:
5452 - __recv::__r_ (receiver*) -- 8
5553 - __recv::__op_ (__operation*) -- 8
5654 - __operation::__inner_op_ (stdexec::connect_result_t<_Sender, __recv<_Sender>>) -- 128 (when connected with an empty receiver & fun)
57- - __operation::__stop_token_ (inplace_stop_token) -- 8
5855 - __operation::__on_heap_ (bool) -- optimized away
5956 - __bulk_functor::__r_ (bulk_item_receiver*) - 8
6057 ---------------------
61- Total: 160 ; extra 32 bytes compared to internal operation state.
58+ Total: 152 ; extra 24 bytes compared to internal operation state.
6259
6360 Using libdispatch backend, the operation sizes are 48 (down from 80) and 128 (down from 160).
6461
@@ -100,11 +97,9 @@ namespace exec::__system_context_default_impl {
10097 }
10198
10299 decltype (auto ) get_env() const noexcept {
103- return stdexec::prop{stdexec::get_stop_token, __get_stop_token ()};
104- }
105-
106- stdexec::inplace_stop_token __get_stop_token () const noexcept {
107- return __op_->__stop_token_ ;
100+ auto __o = __r_->try_query <stdexec::inplace_stop_token>();
101+ stdexec::inplace_stop_token __st = __o ? *__o : stdexec::inplace_stop_token{};
102+ return stdexec::prop{stdexec::get_stop_token, __st};
108103 }
109104 };
110105
@@ -127,22 +122,17 @@ namespace exec::__system_context_default_impl {
127122 struct __operation {
128123 // / The inner operation state, that results out of connecting the underlying sender with the receiver.
129124 stdexec::connect_result_t <_Sender, __recv<_Sender>> __inner_op_;
130- // / The stop token sent to the operation throught dynamic environment.
131- stdexec::inplace_stop_token __stop_token_;
132125 // / True if the operation is on the heap, false if it is in the preallocated space.
133126 bool __on_heap_;
134127
135128 // / Try to construct the operation in the preallocated memory if it fits, otherwise allocate a new operation.
136- static __operation* __construct_maybe_alloc (
137- storage __storage,
138- receiver* __completion,
139- _Sender __sndr,
140- stdexec::inplace_stop_token __st) {
129+ static __operation*
130+ __construct_maybe_alloc (storage __storage, receiver* __completion, _Sender __sndr) {
141131 __storage = __ensure_alignment (__storage, alignof (__operation));
142132 if (__storage.__data == nullptr || __storage.__size < sizeof (__operation)) {
143- return new __operation (std::move (__sndr), __completion, __st, true );
133+ return new __operation (std::move (__sndr), __completion, true );
144134 } else {
145- return new (__storage.__data ) __operation (std::move (__sndr), __completion, __st, false );
135+ return new (__storage.__data ) __operation (std::move (__sndr), __completion, false );
146136 }
147137 }
148138
@@ -161,13 +151,8 @@ namespace exec::__system_context_default_impl {
161151 }
162152
163153 private:
164- __operation (
165- _Sender __sndr,
166- receiver* __completion,
167- stdexec::inplace_stop_token __st,
168- bool __on_heap)
154+ __operation (_Sender __sndr, receiver* __completion, bool __on_heap)
169155 : __inner_op_(stdexec::connect(std::move(__sndr), __recv<_Sender>{__completion, this }))
170- , __stop_token_(std::move(__st))
171156 , __on_heap_(__on_heap) {
172157 }
173158 };
@@ -202,29 +187,25 @@ namespace exec::__system_context_default_impl {
202187 std::declval<__bulk_functor>()))>;
203188
204189 public:
205- void schedule (storage __storage, receiver* __r, env __e ) noexcept override {
190+ void schedule (storage __storage, receiver* __r) noexcept override {
206191 try {
207- auto __o = __e.template try_query <stdexec::inplace_stop_token>();
208- auto __st = __o ? *__o : stdexec::inplace_stop_token{};
209192 auto __sndr = stdexec::schedule (__pool_scheduler_);
210- auto __os = __schedule_operation_t::__construct_maybe_alloc (
211- __storage, __r, std::move (__sndr), std::move (__st ));
193+ auto __os =
194+ __schedule_operation_t::__construct_maybe_alloc ( __storage, __r, std::move (__sndr));
212195 __os->start ();
213196 } catch (std::exception& __e) {
214197 __r->set_error (std::current_exception ());
215198 }
216199 }
217200
218201 void
219- bulk_schedule (uint32_t __size, storage __storage, bulk_item_receiver* __r, env __e ) noexcept
202+ bulk_schedule (uint32_t __size, storage __storage, bulk_item_receiver* __r) noexcept
220203 override {
221204 try {
222- auto __o = __e.template try_query <stdexec::inplace_stop_token>();
223- auto __st = __o ? *__o : stdexec::inplace_stop_token{};
224205 auto __sndr =
225206 stdexec::bulk (stdexec::schedule (__pool_scheduler_), __size, __bulk_functor{__r});
226- auto __os = __bulk_schedule_operation_t::__construct_maybe_alloc (
227- __storage, __r, std::move (__sndr), std::move (__st ));
207+ auto __os =
208+ __bulk_schedule_operation_t::__construct_maybe_alloc ( __storage, __r, std::move (__sndr));
228209 __os->start ();
229210 } catch (std::exception& __e) {
230211 __r->set_error (std::current_exception ());
0 commit comments