[K/N] Rework defines passing to runtime compilation

This commit is contained in:
Pavel Kunyavskiy
2022-08-09 19:12:15 +02:00
committed by Space
parent 339868305e
commit de1dd47ab1
7 changed files with 184 additions and 100 deletions
@@ -1,6 +1,6 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.konan
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.konan.library.KonanLibraryLayout
import org.jetbrains.kotlin.konan.target.Architecture
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.needSmallBinary
import org.jetbrains.kotlin.library.SerializedIrModule
import org.jetbrains.kotlin.library.SerializedMetadata
import org.jetbrains.kotlin.name.ClassId
@@ -318,10 +319,7 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
fun shouldUseDebugInfoFromNativeLibs() = shouldContainAnyDebugInfo() && config.useDebugInfoInNativeLibs
fun shouldOptimize() = config.optimizationsEnabled
fun shouldInlineSafepoints() = when {
config.target.family.isAppleFamily -> config.target.architecture != Architecture.ARM32 // disable for watchos_arm32 and similar
else -> true
}
fun shouldInlineSafepoints() = !config.target.needSmallBinary()
fun ghaEnabled() = ::globalHierarchyAnalysisResult.isInitialized
fun useLazyFileInitializers() = config.propertyLazyInitialization