[K/N] Refactor suspension to reduce generated code size

This commit is contained in:
Pavel Kunyavskiy
2022-01-27 17:18:55 +03:00
committed by Space
parent 41c45b97e7
commit 1bc8061667
2 changed files with 7 additions and 2 deletions
@@ -86,9 +86,13 @@ void kotlin::mm::WaitForThreadsSuspension() noexcept {
}
}
NO_INLINE void kotlin::mm::SuspendIfRequestedSlowPath() noexcept {
mm::ThreadRegistry::Instance().CurrentThreadData()->suspensionData().suspendIfRequestedSlowPath();
}
ALWAYS_INLINE void kotlin::mm::SuspendIfRequested() noexcept {
if (IsThreadSuspensionRequested()) {
mm::ThreadRegistry::Instance().CurrentThreadData()->suspensionData().suspendIfRequestedSlowPath();
SuspendIfRequestedSlowPath();
}
}
@@ -49,7 +49,7 @@ public:
}
private:
friend void SuspendIfRequested() noexcept;
friend void SuspendIfRequestedSlowPath() noexcept;
std::atomic<ThreadState> state_;
std::atomic<bool> suspended_;
@@ -58,6 +58,7 @@ private:
bool RequestThreadsSuspension() noexcept;
void WaitForThreadsSuspension() noexcept;
void SuspendIfRequestedSlowPath() noexcept;
void SuspendIfRequested() noexcept;
/**