[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
@@ -35,7 +35,7 @@ abstract class BasicIrModuleDeserializer(
private val moduleDeserializationState = ModuleDeserializationState(linker, this)
internal val moduleReversedFileIndex = mutableMapOf<IdSignature, FileDeserializationState>()
val moduleReversedFileIndex = mutableMapOf<IdSignature, FileDeserializationState>()
override val moduleDependencies by lazy {
moduleDescriptor.allDependencyModules.filter { it != moduleDescriptor }.map { linker.resolveModuleDeserializer(it, null) }
@@ -110,6 +110,7 @@ abstract class BasicIrModuleDeserializer(
val fileDeserializationState = FileDeserializationState(
linker,
fileIndex,
file,
fileReader,
fileProto,
@@ -57,8 +57,9 @@ class IrFileDeserializer(
class FileDeserializationState(
val linker: KotlinIrLinker,
val fileIndex: Int,
file: IrFile,
fileReader: IrLibraryFileFromBytes,
val fileReader: IrLibraryFileFromBytes,
fileProto: ProtoFile,
deserializeBodies: Boolean,
allowErrorNodes: Boolean,
@@ -22,6 +22,7 @@ internal fun IrSymbol.kind(): BinarySymbolData.SymbolKind {
is IrPropertySymbol -> BinarySymbolData.SymbolKind.PROPERTY_SYMBOL
is IrEnumEntrySymbol -> BinarySymbolData.SymbolKind.ENUM_ENTRY_SYMBOL
is IrTypeAliasSymbol -> BinarySymbolData.SymbolKind.TYPEALIAS_SYMBOL
is IrTypeParameterSymbol -> BinarySymbolData.SymbolKind.TYPE_PARAMETER_SYMBOL
else -> error("Unexpected symbol kind $this")
}
}