[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
@@ -14,7 +14,7 @@ sealed class ConeIntegerLiteralType(
abstract val possibleTypes: Collection<ConeClassLikeType>
abstract val supertypes: List<ConeClassLikeType>
final override val typeArguments: Array<out ConeTypeProjection> = emptyArray()
final override val typeArguments: Array<out ConeTypeProjection> get() = EMPTY_ARRAY
final override val attributes: ConeAttributes get() = ConeAttributes.Empty
abstract fun getApproximatedType(expectedType: ConeKotlinType? = null): ConeClassLikeType
@@ -16,7 +16,7 @@ class ConeTypeVariableType(
override val lookupTag: ConeTypeVariableTypeConstructor,
override val attributes: ConeAttributes = ConeAttributes.Empty,
) : ConeLookupTagBasedType() {
override val typeArguments: Array<out ConeTypeProjection> get() = emptyArray()
override val typeArguments: Array<out ConeTypeProjection> get() = EMPTY_ARRAY
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ConeTypeVariableType) return false
@@ -65,7 +65,7 @@ sealed class ConeStubType(val constructor: ConeStubTypeConstructor, override val
ConeSimpleKotlinType() {
override val typeArguments: Array<out ConeTypeProjection>
get() = emptyArray()
get() = EMPTY_ARRAY
override val attributes: ConeAttributes
get() = ConeAttributes.Empty
@@ -144,7 +144,7 @@ data class ConeCapturedType(
)
override val typeArguments: Array<out ConeTypeProjection>
get() = emptyArray()
get() = EMPTY_ARRAY
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -220,7 +220,7 @@ class ConeIntersectionType(
val alternativeType: ConeKotlinType? = null,
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
override val typeArguments: Array<out ConeTypeProjection>
get() = emptyArray()
get() = EMPTY_ARRAY
override val nullability: ConeNullability
get() = ConeNullability.NOT_NULL