Native: support reentrant mode for CalledFromNativeGuard

This commit is contained in:
Svyatoslav Scherbina
2021-06-08 12:25:07 +03:00
committed by Space
parent 1bcafd3cd0
commit 85ab4f68df
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -532,10 +532,10 @@ MemoryState* kotlin::mm::GetMemoryState() {
return ToMemoryState(ThreadRegistry::Instance().CurrentThreadDataNode());
}
ALWAYS_INLINE kotlin::CalledFromNativeGuard::CalledFromNativeGuard() noexcept {
ALWAYS_INLINE kotlin::CalledFromNativeGuard::CalledFromNativeGuard(bool reentrant) noexcept : reentrant_(reentrant) {
Kotlin_initRuntimeIfNeeded();
thread_ = mm::GetMemoryState();
SwitchThreadState(thread_, ThreadState::kRunnable);
oldState_ = SwitchThreadState(thread_, ThreadState::kRunnable, reentrant_);
}
const bool kotlin::kSupportsMultipleMutators = kotlin::gc::kSupportsMultipleMutators;