[K/N] remove class field types from caches
^KT-65443
This commit is contained in:
+5
-8
@@ -110,10 +110,9 @@ internal object InlineFunctionBodyReferenceSerializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// [binaryType] is needed in case a field is of a primitive type. Otherwise we know it's an object type and
|
||||||
// [binaryType] is needed in case a field is of a private inline class type (which can't be deserialized).
|
// that is enough information for the backend.
|
||||||
// But it is safe to just set the field's type to the primitive type the inline class will be erased to.
|
class SerializedClassFieldInfo(val name: String, val binaryType: Int, val flags: Int, val alignment: Int) {
|
||||||
class SerializedClassFieldInfo(val name: String, val binaryType: Int, val type: Int, val flags: Int, val alignment: Int) {
|
|
||||||
companion object {
|
companion object {
|
||||||
const val FLAG_IS_CONST = 1
|
const val FLAG_IS_CONST = 1
|
||||||
}
|
}
|
||||||
@@ -155,7 +154,7 @@ internal object ClassFieldsSerializer {
|
|||||||
it.fields.forEach { +it.name }
|
it.fields.forEach { +it.name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val size = stringTable.sizeBytes + classFields.sumOf { Int.SIZE_BYTES * (6 + it.typeParameterSigs.size + it.fields.size * 5) }
|
val size = stringTable.sizeBytes + classFields.sumOf { Int.SIZE_BYTES * (6 + it.typeParameterSigs.size + it.fields.size * 4) }
|
||||||
val stream = ByteArrayStream(ByteArray(size))
|
val stream = ByteArrayStream(ByteArray(size))
|
||||||
stringTable.serialize(stream)
|
stringTable.serialize(stream)
|
||||||
classFields.forEach {
|
classFields.forEach {
|
||||||
@@ -168,7 +167,6 @@ internal object ClassFieldsSerializer {
|
|||||||
it.fields.forEach { field ->
|
it.fields.forEach { field ->
|
||||||
stream.writeInt(stringTable.indices[field.name]!!)
|
stream.writeInt(stringTable.indices[field.name]!!)
|
||||||
stream.writeInt(field.binaryType)
|
stream.writeInt(field.binaryType)
|
||||||
stream.writeInt(field.type)
|
|
||||||
stream.writeInt(field.flags)
|
stream.writeInt(field.flags)
|
||||||
stream.writeInt(field.alignment)
|
stream.writeInt(field.alignment)
|
||||||
}
|
}
|
||||||
@@ -209,10 +207,9 @@ internal object ClassFieldsSerializer {
|
|||||||
val fields = Array(fieldsCount) {
|
val fields = Array(fieldsCount) {
|
||||||
val name = stringTable[stream.readInt()]
|
val name = stringTable[stream.readInt()]
|
||||||
val binaryType = stream.readInt()
|
val binaryType = stream.readInt()
|
||||||
val type = stream.readInt()
|
|
||||||
val flags = stream.readInt()
|
val flags = stream.readInt()
|
||||||
val alignment = stream.readInt()
|
val alignment = stream.readInt()
|
||||||
SerializedClassFieldInfo(name, binaryType, type, flags, alignment)
|
SerializedClassFieldInfo(name, binaryType, flags, alignment)
|
||||||
}
|
}
|
||||||
val fileSignature = IdSignature.FileSignature(
|
val fileSignature = IdSignature.FileSignature(
|
||||||
id = Any(),
|
id = Any(),
|
||||||
|
|||||||
-5
@@ -243,7 +243,6 @@ internal class KonanPartialModuleDeserializer(
|
|||||||
SerializedClassFieldInfo(
|
SerializedClassFieldInfo(
|
||||||
name = "",
|
name = "",
|
||||||
binaryType = INVALID_INDEX,
|
binaryType = INVALID_INDEX,
|
||||||
nameAndType.typeIndex,
|
|
||||||
flags = 0,
|
flags = 0,
|
||||||
field.alignment
|
field.alignment
|
||||||
)
|
)
|
||||||
@@ -260,9 +259,6 @@ internal class KonanPartialModuleDeserializer(
|
|||||||
SerializedClassFieldInfo(
|
SerializedClassFieldInfo(
|
||||||
field.name,
|
field.name,
|
||||||
primitiveBinaryType?.ordinal ?: INVALID_INDEX,
|
primitiveBinaryType?.ordinal ?: INVALID_INDEX,
|
||||||
if (with(KonanManglerIr) { (classifier as? IrClassSymbol)?.owner?.isExported(compatibleMode) } == false)
|
|
||||||
INVALID_INDEX
|
|
||||||
else nameAndType.typeIndex,
|
|
||||||
flags,
|
flags,
|
||||||
field.alignment
|
field.alignment
|
||||||
)
|
)
|
||||||
@@ -480,7 +476,6 @@ internal class KonanPartialModuleDeserializer(
|
|||||||
} else {
|
} else {
|
||||||
val name = field.name
|
val name = field.name
|
||||||
val type = when {
|
val type = when {
|
||||||
field.type != INVALID_INDEX -> declarationDeserializer.deserializeIrType(field.type)
|
|
||||||
field.binaryType == INVALID_INDEX -> builtIns.anyNType
|
field.binaryType == INVALID_INDEX -> builtIns.anyNType
|
||||||
else -> when (PrimitiveBinaryType.values().getOrNull(field.binaryType)) {
|
else -> when (PrimitiveBinaryType.values().getOrNull(field.binaryType)) {
|
||||||
PrimitiveBinaryType.BOOLEAN -> builtIns.booleanType
|
PrimitiveBinaryType.BOOLEAN -> builtIns.booleanType
|
||||||
|
|||||||
Reference in New Issue
Block a user