Revert "[K/N] remove class field types from caches"
This reverts commit 1f1522b787.
This commit is contained in:
+8
-5
@@ -110,9 +110,10 @@ internal object InlineFunctionBodyReferenceSerializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [binaryType] is needed in case a field is of a primitive type. Otherwise we know it's an object type and
|
|
||||||
// that is enough information for the backend.
|
// [binaryType] is needed in case a field is of a private inline class type (which can't be deserialized).
|
||||||
class SerializedClassFieldInfo(val name: String, val binaryType: Int, val flags: Int, val alignment: Int) {
|
// 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 type: Int, val flags: Int, val alignment: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
const val FLAG_IS_CONST = 1
|
const val FLAG_IS_CONST = 1
|
||||||
}
|
}
|
||||||
@@ -154,7 +155,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 * 4) }
|
val size = stringTable.sizeBytes + classFields.sumOf { Int.SIZE_BYTES * (6 + it.typeParameterSigs.size + it.fields.size * 5) }
|
||||||
val stream = ByteArrayStream(ByteArray(size))
|
val stream = ByteArrayStream(ByteArray(size))
|
||||||
stringTable.serialize(stream)
|
stringTable.serialize(stream)
|
||||||
classFields.forEach {
|
classFields.forEach {
|
||||||
@@ -167,6 +168,7 @@ 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)
|
||||||
}
|
}
|
||||||
@@ -207,9 +209,10 @@ 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, flags, alignment)
|
SerializedClassFieldInfo(name, binaryType, type, flags, alignment)
|
||||||
}
|
}
|
||||||
val fileSignature = IdSignature.FileSignature(
|
val fileSignature = IdSignature.FileSignature(
|
||||||
id = Any(),
|
id = Any(),
|
||||||
|
|||||||
+5
@@ -243,6 +243,7 @@ internal class KonanPartialModuleDeserializer(
|
|||||||
SerializedClassFieldInfo(
|
SerializedClassFieldInfo(
|
||||||
name = "",
|
name = "",
|
||||||
binaryType = INVALID_INDEX,
|
binaryType = INVALID_INDEX,
|
||||||
|
nameAndType.typeIndex,
|
||||||
flags = 0,
|
flags = 0,
|
||||||
field.alignment
|
field.alignment
|
||||||
)
|
)
|
||||||
@@ -259,6 +260,9 @@ 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
|
||||||
)
|
)
|
||||||
@@ -476,6 +480,7 @@ 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