[K/N][New MM] Move ThreadStateGuard to the main Memory.h

Integrating the stdlib with the thread states machinery requires
accessing to some parts of the new MM. This patch provides this
access by moving these parts to the main Memory.h header.
This commit is contained in:
Ilya Matveev
2021-02-28 16:06:37 +07:00
committed by TeamCityServer
parent 482305cfb2
commit 6643119f08
12 changed files with 254 additions and 131 deletions
@@ -427,3 +427,15 @@ extern "C" RUNTIME_NOTHROW void Kotlin_mm_safePointExceptionUnwind() {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().SafePointExceptionUnwind();
}
extern "C" ALWAYS_INLINE RUNTIME_NOTHROW void Kotlin_mm_switchThreadStateNative() {
SwitchThreadState(mm::ThreadRegistry::Instance().CurrentThreadData(), ThreadState::kNative);
}
extern "C" ALWAYS_INLINE RUNTIME_NOTHROW void Kotlin_mm_switchThreadStateRunnable() {
SwitchThreadState(mm::ThreadRegistry::Instance().CurrentThreadData(), ThreadState::kRunnable);
}
MemoryState* kotlin::mm::GetMemoryState() {
return ToMemoryState(ThreadRegistry::Instance().CurrentThreadDataNode());
}