[K/N] Add tracking of application state to the GC scheduler.

Merge-request: KT-MR-6435
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2022-06-28 06:38:36 +00:00
committed by Space
parent fcfc79aa35
commit d47193d36f
21 changed files with 1246 additions and 22 deletions
@@ -25,6 +25,8 @@ RUNTIME_WEAK Kotlin_getSourceInfo_FunctionType Kotlin_getSourceInfo_Function = n
#ifdef KONAN_ANDROID
RUNTIME_WEAK int32_t Kotlin_printToAndroidLogcat = 1;
#endif
// Keep it 0 even when the compiler defaults to 1: if the overriding mechanism breaks, keeping it disabled is safer.
RUNTIME_WEAK int32_t Kotlin_appStateTracking = 0;
ALWAYS_INLINE compiler::DestroyRuntimeMode compiler::destroyRuntimeMode() noexcept {
return static_cast<compiler::DestroyRuntimeMode>(Kotlin_destroyRuntimeMode);
@@ -39,6 +41,9 @@ ALWAYS_INLINE bool compiler::suspendFunctionsFromAnyThreadFromObjCEnabled() noex
return Kotlin_suspendFunctionsFromAnyThreadFromObjC != 0;
}
ALWAYS_INLINE compiler::AppStateTracking compiler::appStateTracking() noexcept {
return static_cast<compiler::AppStateTracking>(Kotlin_appStateTracking);
}
#ifdef KONAN_ANDROID
ALWAYS_INLINE bool compiler::printToAndroidLogcat() noexcept {
@@ -52,4 +57,4 @@ ALWAYS_INLINE int compiler::getSourceInfo(void* addr, SourceInfo *result, int re
} else {
return Kotlin_getSourceInfo_Function(addr, result, result_size);
}
}
}