[K/N] Add binary option to disable freezing

We don't want to deprecate freezing at all, but it is possible
that freezing, new memory model and lazy global initialization
combination might not work in some cases. It might be a problem
when such case appears in 3rd-party library that user can't fix.

To mitigate this problem this commit introduces `freezing` binary
option. It has three variants:
* Full - ol' good behavior.
* Disabled - well, no freezing at all.
* ExplicitOnly - a compromise when user want to freeze something
themselves, but something is messed up during globals initialization.
This commit is contained in:
Sergey Bogolepov
2021-08-28 11:10:49 +07:00
committed by Space
parent db34f67c1c
commit 4b5a7c6646
9 changed files with 70 additions and 5 deletions
@@ -13,6 +13,7 @@ using namespace kotlin;
RUNTIME_WEAK int32_t Kotlin_destroyRuntimeMode = 1;
RUNTIME_WEAK int32_t Kotiln_gcAggressive = 0;
RUNTIME_WEAK int32_t Kotlin_workerExceptionHandling = 0;
RUNTIME_WEAK int32_t Kotlin_freezingEnabled = 1;
ALWAYS_INLINE compiler::DestroyRuntimeMode compiler::destroyRuntimeMode() noexcept {
return static_cast<compiler::DestroyRuntimeMode>(Kotlin_destroyRuntimeMode);
@@ -25,3 +26,7 @@ ALWAYS_INLINE bool compiler::gcAggressive() noexcept {
ALWAYS_INLINE compiler::WorkerExceptionHandling compiler::workerExceptionHandling() noexcept {
return static_cast<compiler::WorkerExceptionHandling>(Kotlin_workerExceptionHandling);
}
ALWAYS_INLINE bool compiler::freezingEnabled() noexcept {
return Kotlin_freezingEnabled != 0;
}