[K/N] Improve consistency of using setConst vs override RuntimeGlobals
This commit is contained in:
@@ -10,14 +10,18 @@
|
||||
|
||||
using namespace kotlin;
|
||||
|
||||
// These are defined by overrideRuntimeGlobals in IrToBitcode.kt
|
||||
using Kotlin_getSourceInfo_FunctionType = int(*)(void * /*addr*/, SourceInfo* /*result*/, int /*result_size*/);
|
||||
|
||||
/**
|
||||
* There are two ways, how compiler can define variables for runtime usage. This one, and the other one with details in header file.
|
||||
*
|
||||
* This is one is variables defined by overrideRuntimeGlobals in IrToBitcode.kt. They are *not* eligible for runtime optimizations,
|
||||
* but can be changed after compiling caches. So use this way for variables, which will be rarely accessed.
|
||||
*/
|
||||
RUNTIME_WEAK int32_t Kotlin_destroyRuntimeMode = 1;
|
||||
RUNTIME_WEAK int32_t Kotlin_gcSchedulerType = 2;
|
||||
RUNTIME_WEAK int32_t Kotlin_workerExceptionHandling = 0;
|
||||
RUNTIME_WEAK int32_t Kotlin_freezingEnabled = 1;
|
||||
RUNTIME_WEAK int32_t Kotlin_freezingChecksEnabled = 1;
|
||||
RUNTIME_WEAK int32_t Kotlin_suspendFunctionsFromAnyThreadFromObjC = 0;
|
||||
RUNTIME_WEAK const Kotlin_getSourceInfo_FunctionType Kotlin_getSourceInfo_Function = nullptr;
|
||||
RUNTIME_WEAK Kotlin_getSourceInfo_FunctionType Kotlin_getSourceInfo_Function = nullptr;
|
||||
#ifdef KONAN_ANDROID
|
||||
RUNTIME_WEAK int32_t Kotlin_printToAndroidLogcat = 1;
|
||||
#endif
|
||||
@@ -30,24 +34,22 @@ ALWAYS_INLINE compiler::WorkerExceptionHandling compiler::workerExceptionHandlin
|
||||
return static_cast<compiler::WorkerExceptionHandling>(Kotlin_workerExceptionHandling);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool compiler::freezingEnabled() noexcept {
|
||||
return Kotlin_freezingEnabled != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool compiler::freezingChecksEnabled() noexcept {
|
||||
return Kotlin_freezingChecksEnabled != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool compiler::suspendFunctionsFromAnyThreadFromObjCEnabled() noexcept {
|
||||
return Kotlin_suspendFunctionsFromAnyThreadFromObjC != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE compiler::GCSchedulerType compiler::getGCSchedulerType() noexcept {
|
||||
return static_cast<compiler::GCSchedulerType>(Kotlin_gcSchedulerType);
|
||||
}
|
||||
|
||||
#ifdef KONAN_ANDROID
|
||||
ALWAYS_INLINE bool compiler::printToAndroidLogcat() noexcept {
|
||||
return Kotlin_printToAndroidLogcat != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
ALWAYS_INLINE int compiler::getSourceInfo(void* addr, SourceInfo *result, int result_size) noexcept {
|
||||
if (Kotlin_getSourceInfo_Function == nullptr) {
|
||||
return 0;
|
||||
} else {
|
||||
return Kotlin_getSourceInfo_Function(addr, result, result_size);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user