[K/N][New MM] Disallow getting thread data for detached threads

This patch fixes a performance degradation introduced by
99bd26c2ef (Switch thread states
in termination handlers).
This commit is contained in:
Ilya Matveev
2021-09-03 17:23:33 +07:00
committed by Space
parent 3a4e8e7a61
commit bfc4ff6343
9 changed files with 44 additions and 18 deletions
@@ -541,6 +541,10 @@ MemoryState* kotlin::mm::GetMemoryState() noexcept {
return ToMemoryState(ThreadRegistry::Instance().CurrentThreadDataNode());
}
bool kotlin::mm::IsCurrentThreadRegistered() noexcept {
return ThreadRegistry::Instance().IsCurrentThreadRegistered();
}
ALWAYS_INLINE kotlin::CalledFromNativeGuard::CalledFromNativeGuard(bool reentrant) noexcept : reentrant_(reentrant) {
Kotlin_initRuntimeIfNeeded();
thread_ = mm::GetMemoryState();