-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make few tasks #184
Make few tasks #184
Conversation
Pull Request Test Coverage Report for Build 2763811443
💛 - Coveralls |
Codecov Report
@@ Coverage Diff @@
## main #184 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 57 60 +3
Lines 1348 1361 +13
=========================================
+ Hits 1348 1361 +13
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
305e030
to
1a1def5
Compare
fa8057a
to
a3a5359
Compare
* Remove atomic counter in shared state (we can use our state machine to determine when we need to remove it). atomic counter increment/decrement have a big cost in some scenarios * Decrease size of Future shared state to make it allocation cheaper * Some refactoring * Few fixes * Fix macOS and Windows CI * Add gcc-12 to CI
ea5782a
to
21b3036
Compare
YACLIB_ASSERT(std::exchange(_caller, &kEmptyRef) != nullptr); | ||
caller->DecRef(); | ||
// auto expected = _callback.load(std::memory_order_acquire); | ||
// if (expected == kEmpty || (expected & kMask) == kWaitNope) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I think it can be checked like ((expected & kMask) & ~kWaitNope) == 0?
I don't sure about will it better ot not.
Now we are always have 1 exchange + 1 load + optional(check load) cas
If here will be cas will be 2 load + 2 optional(check load) cas (1-2), I don't think it's definitely better so needs benchmark
I think on x86 current code will be better but for arm maybe 2 cas better, especially if compiler remove unnecessary loads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, have here cas instead of exchange definitely bad idea because we need cycle for timed wait case
uses: egor-tensin/setup-mingw@v2 | ||
with: | ||
platform: x64 | ||
# TODO(MBkkt) https://github.com/msys2/setup-msys2? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to create issue
_executor->Submit(callback); | ||
#ifdef YACLIB_LOG_DEBUG | ||
BaseCore::~BaseCore() noexcept { | ||
YACLIB_ASSERT(_caller == &kEmptyRef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add more asserts
#endif | ||
|
||
yaclib_std::atomic_uint64_t _callback; | ||
IRef* _caller{nullptr}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove default initialize
IExecutor* BaseCore::GetExecutor() const noexcept { | ||
return _executor.Get(); | ||
bool BaseCore::SetWait(IRef& callback, State state) noexcept { | ||
// YACLIB_ASSERT(state == kWaitNope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
} | ||
|
||
IExecutor* BaseCore::GetExecutor() const noexcept { | ||
return _executor.Get(); | ||
bool BaseCore::SetWait(IRef& callback, State state) noexcept { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can remove virtual call for waiters
case kHereCall: { | ||
auto* callback = reinterpret_cast<IRef*>(expected & ~kMask); | ||
YACLIB_ASSERT(callback != nullptr); | ||
Submit(static_cast<BaseCore&>(*callback), state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InlineCore&
@@ -31,7 +33,7 @@ class SafeCall { | |||
} | |||
|
|||
private: | |||
Store _func; | |||
[[no_unique_address]] Store _func; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make macro to prevent unknown attribute warning
template <typename Func> | ||
Job* MakeUniqueJob(Func&& f) { | ||
return new UniqueJob<Func>{std::forward<Func>(f)}; | ||
return new UniqueJob<decltype(std::forward<Func>(f))>{std::forward<Func>(f)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Func&&>
@@ -0,0 +1,95 @@ | |||
#pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove or implement
Purpose
Related Information
Testing