IR: refactor IdSignatureSerializer

Use a separate instance for each file.
This commit is contained in:
Anton Bannykh
2021-04-27 15:37:14 +03:00
parent 87dd357ec6
commit 600099585d
10 changed files with 60 additions and 50 deletions
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.resolve.descriptorUtil.module
class KonanGlobalDeclarationTable(signatureSerializer: IdSignatureSerializer, builtIns: IrBuiltIns) : GlobalDeclarationTable(signatureSerializer, KonanManglerIr) {
class KonanGlobalDeclarationTable(builtIns: IrBuiltIns) : GlobalDeclarationTable(KonanManglerIr) {
init {
loadKnownBuiltins(builtIns)
}
@@ -16,8 +16,7 @@ class KonanIrModuleSerializer(
val skipExpects: Boolean
) : IrModuleSerializer<KonanIrFileSerializer>(messageLogger) {
private val signaturer = IdSignatureSerializer(KonanManglerIr)
private val globalDeclarationTable = KonanGlobalDeclarationTable(signaturer, irBuiltIns)
private val globalDeclarationTable = KonanGlobalDeclarationTable(irBuiltIns)
// We skip files with IR for C structs and enums because they should be
// generated anew.
@@ -91,7 +91,7 @@ internal class KonanIrLinker(
override fun isBuiltInModule(moduleDescriptor: ModuleDescriptor): Boolean = moduleDescriptor.isNativeStdlib()
private val forwardDeclarationDeserializer = forwardModuleDescriptor?.let { KonanForwardDeclarationModuleDeserializer(it) }
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(KonanManglerIr), builtIns, KonanFakeOverrideClassFilter)
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, KonanManglerIr, builtIns, KonanFakeOverrideClassFilter)
override fun createModuleDeserializer(moduleDescriptor: ModuleDescriptor, klib: IrLibrary?, strategy: DeserializationStrategy): IrModuleDeserializer {
if (moduleDescriptor === forwardModuleDescriptor) {