[K/N][IR][codegen] Use LazyIr for cached libraries

It's not that simple because we still need inline functions bodies
and classes fields which aren't present in Lazy IR. To overcome this,
save additional binary info for a cached library and then use it when needed
This commit is contained in:
Igor Chevdar
2021-08-24 21:14:52 +05:00
parent f865238062
commit 0cece79856
31 changed files with 1042 additions and 140 deletions
@@ -364,6 +364,15 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
WorkerExceptionHandling.LEGACY
}
})
put(LAZY_IR_FOR_CACHES, when (arguments.lazyIrForCaches) {
null -> true
"enable" -> true
"disable" -> false
else -> {
configuration.report(ERROR, "Expected 'enable' or 'disable' for lazy IR usage for cached libraries")
false
}
})
arguments.externalDependencies?.let { put(EXTERNAL_DEPENDENCIES, it) }
putIfNotNull(LLVM_VARIANT, when (val variant = arguments.llvmVariant) {
@@ -361,6 +361,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xruntime-logs", valueDescription = "<tag1=level1,tag2=level2,...>", description = "Enable logging for runtime with tags.")
var runtimeLogs: String? = null
@Argument(value = "-Xlazy-ir-for-caches", valueDescription = "{disable|enable}", description = "Use lazy IR for cached libraries")
var lazyIrForCaches: String? = null
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector, languageVersion).also {
val optInList = it[AnalysisFlags.optIn] as List<*>