[K/N] Support non-LazyIR for cached libraries

Use the same lazy deserialization mechanism (inline function bodies, class fields)
for both LazyIR and usual IR
This commit is contained in:
Igor Chevdar
2023-06-13 12:28:30 +03:00
committed by Space Team
parent 6318da0f02
commit cc9dd48c09
7 changed files with 112 additions and 94 deletions
@@ -577,6 +577,16 @@ class IrDeclarationDeserializer(
}
}
fun <T : IrFunction> T.withDeserializeBodies(block: T.() -> Unit) {
val oldBodiesPolicy = deserializeBodies
try {
deserializeBodies = true
usingParent { block() }
} finally {
deserializeBodies = oldBodiesPolicy
}
}
internal fun deserializeIrFunction(proto: ProtoFunction, setParent: Boolean = true): IrSimpleFunction =
withDeserializedIrFunctionBase<IrSimpleFunctionSymbol, IrSimpleFunction>(
proto.base,
@@ -102,7 +102,7 @@ abstract class KotlinIrLinker(
protected abstract fun isBuiltInModule(moduleDescriptor: ModuleDescriptor): Boolean
private fun deserializeAllReachableTopLevels() {
fun deserializeAllReachableTopLevels() {
while (modulesWithReachableTopLevels.isNotEmpty()) {
val moduleDeserializer = modulesWithReachableTopLevels.first()
modulesWithReachableTopLevels.remove(moduleDeserializer)