[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:
committed by
Space Team
parent
04d330edae
commit
bdfc68468f
+1
-1
@@ -187,7 +187,7 @@ abstract class AbstractAnnotationDeserializer(
|
||||
val classId = nameResolver.getClassId(proto.id)
|
||||
return buildAnnotation {
|
||||
annotationTypeRef = buildResolvedTypeRef {
|
||||
type = classId.toLookupTag().constructClassType(emptyArray(), isNullable = false)
|
||||
type = classId.toLookupTag().constructClassType(ConeTypeProjection.EMPTY_ARRAY, isNullable = false)
|
||||
}
|
||||
session.lazyDeclarationResolver.disableLazyResolveContractChecksInside {
|
||||
this.argumentMapping = createArgumentMapping(proto, classId, nameResolver)
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.ConeTypeProjection
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
@@ -168,7 +169,7 @@ fun deserializeClassToSymbol(
|
||||
classProto.enumEntryList.mapNotNull { enumEntryProto ->
|
||||
val enumEntryName = nameResolver.getName(enumEntryProto.name)
|
||||
|
||||
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), emptyArray(), false)
|
||||
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, false)
|
||||
val property = buildEnumEntry {
|
||||
this.moduleData = moduleData
|
||||
this.origin = FirDeclarationOrigin.Library
|
||||
@@ -265,7 +266,7 @@ fun FirRegularClassBuilder.addCloneForArrayIfNeeded(classId: ClassId, dispatchRe
|
||||
superTypeRefs += buildResolvedTypeRef {
|
||||
type = ConeClassLikeTypeImpl(
|
||||
StandardClassIds.Cloneable.toLookupTag(),
|
||||
typeArguments = emptyArray(),
|
||||
typeArguments = ConeTypeProjection.EMPTY_ARRAY,
|
||||
isNullable = false
|
||||
)
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.getClassDeclaredPropertySymbols
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
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
|
||||
@@ -45,7 +46,7 @@ fun FirEnumEntryDeserializedAccessExpression.toQualifiedPropertyAccessExpression
|
||||
|
||||
typeRef = buildResolvedTypeRef {
|
||||
type = ConeClassLikeTypeImpl(
|
||||
enumClassId.toLookupTag(), emptyArray(), isNullable = false
|
||||
enumClassId.toLookupTag(), ConeTypeProjection.EMPTY_ARRAY, isNullable = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user