IR: only worry about threads in JvmIrSignatureDescriptor

General IdSignatureDescriptor is used from other backends, which have no
multi-threaded backend for now and do not need to carry the associated
runtime costs.

So IdSignatureDescriptor keeps the thread-unsafe caching of signature
builder.
This commit is contained in:
Georgy Bronnikov
2021-02-13 13:54:04 +03:00
parent cacfe53065
commit db18ffc764
3 changed files with 21 additions and 3 deletions
@@ -105,15 +105,17 @@ open class IdSignatureDescriptor(private val mangler: KotlinMangler.DescriptorMa
reportUnexpectedDescriptor(descriptor)
}
private val composer by lazy { createSignatureBuilder() }
override fun composeSignature(descriptor: DeclarationDescriptor): IdSignature? {
return if (mangler.run { descriptor.isExported() }) {
createSignatureBuilder().buildSignature(descriptor)
composer.buildSignature(descriptor)
} else null
}
override fun composeEnumEntrySignature(descriptor: ClassDescriptor): IdSignature? {
return if (mangler.run { descriptor.isExportEnumEntry() }) {
createSignatureBuilder().buildSignature(descriptor)
composer.buildSignature(descriptor)
} else null
}
}