[LL FIR] KT-57220 Optimize & combine synthetic function symbol providers

- Dependency symbol providers contained a lot of useless
  `FirExtensionSyntheticFunctionInterfaceProvider`s, because such a
  provider only generates function classes from compiler plugins. If
  there aren't any such `FunctionTypeKind`s in the session, there is no
  need to even add the provider.
- `FirExtensionSyntheticFunctionInterfaceProvider`s that are added to
  the list of dependency providers despite this optimization will now be
  combined in `LLFirCombinedSyntheticFunctionSymbolProvider`. It checks
  `ClassId` heuristics once, which is more efficient than checking them
  in every provider separately.
This commit is contained in:
Marco Pennekamp
2023-03-09 20:00:02 +01:00
committed by Space Team
parent 09ab192205
commit 2d85e9db51
5 changed files with 101 additions and 6 deletions
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.name.FqName
@RequiresOptIn
annotation class AllowedToUsedOnlyInK1
class FunctionTypeKindExtractor(kinds: List<FunctionTypeKind>) {
class FunctionTypeKindExtractor(private val kinds: List<FunctionTypeKind>) {
companion object {
/**
* This instance should be used only in:
@@ -49,6 +49,10 @@ class FunctionTypeKindExtractor(kinds: List<FunctionTypeKind>) {
return packageFqName in knownKindsByPackageFqName
}
fun getFunctionKindPackageNames(): Set<FqName> = knownKindsByPackageFqName.keys
fun hasExtensionKinds(): Boolean = kinds.any { !it.isBuiltin }
data class KindWithArity(val kind: FunctionTypeKind, val arity: Int)
private fun toInt(s: String): Int? {