[FIR] optimize direct allocation of empty ConeTypeProjection arrays

On the snapshot from KTIJ-26260 empty ConeTypeProjection arrays take about 10mb
This commit is contained in:
Ilya Kirillov
2023-08-17 16:10:28 +02:00
committed by Space Team
parent 04d330edae
commit bdfc68468f
19 changed files with 35 additions and 24 deletions
@@ -217,7 +217,7 @@ private fun JavaClassifierType.toConeKotlinTypeForFlexibleBound(
else -> lowerBound?.typeArguments
}
lookupTag.constructClassType(mappedTypeArguments ?: emptyArray(), isNullable = lowerBound != null, attributes)
lookupTag.constructClassType(mappedTypeArguments ?: ConeTypeProjection.EMPTY_ARRAY, isNullable = lowerBound != null, attributes)
}
is JavaTypeParameter -> {
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder
import org.jetbrains.kotlin.fir.deserialization.FirConstDeserializer
import org.jetbrains.kotlin.fir.deserialization.FirDeserializationExtension
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
import org.jetbrains.kotlin.fir.types.toLookupTag
@@ -43,7 +44,7 @@ class FirJvmDeserializationExtension(session: FirSession) : FirDeserializationEx
superTypeRefs += buildResolvedTypeRef {
type = ConeClassLikeTypeImpl(
JAVA_IO_SERIALIZABLE.toLookupTag(),
typeArguments = emptyArray(),
typeArguments = ConeTypeProjection.EMPTY_ARRAY,
isNullable = false
)
}