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.
|
||||
class SerializedClassFieldInfo(val name: String, val binaryType: Int, val flags: Int, val alignment: Int) {
|
||||
|
||||
// [binaryType] is needed in case a field is of a private inline class type (which can't be deserialized).
|
||||
// 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 {
|
||||
const val FLAG_IS_CONST = 1
|
||||
}
|
||||
@@ -154,7 +155,7 @@ internal object ClassFieldsSerializer {
|
||||
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))
|
||||
stringTable.serialize(stream)
|
||||
classFields.forEach {
|
||||
@@ -167,6 +168,7 @@ internal object ClassFieldsSerializer {
|
||||
it.fields.forEach { field ->
|
||||
stream.writeInt(stringTable.indices[field.name]!!)
|
||||
stream.writeInt(field.binaryType)
|
||||
stream.writeInt(field.type)
|
||||
stream.writeInt(field.flags)
|
||||
stream.writeInt(field.alignment)
|
||||
}
|
||||
@@ -207,9 +209,10 @@ internal object ClassFieldsSerializer {
|
||||
val fields = Array(fieldsCount) {
|
||||
val name = stringTable[stream.readInt()]
|
||||
val binaryType = stream.readInt()
|
||||
val type = stream.readInt()
|
||||
val flags = stream.readInt()
|
||||
val alignment = stream.readInt()
|
||||
SerializedClassFieldInfo(name, binaryType, flags, alignment)
|
||||
SerializedClassFieldInfo(name, binaryType, type, flags, alignment)
|
||||
}
|
||||
val fileSignature = IdSignature.FileSignature(
|
||||
id = Any(),
|
||||
|
||||
+5
@@ -243,6 +243,7 @@ internal class KonanPartialModuleDeserializer(
|
||||
SerializedClassFieldInfo(
|
||||
name = "",
|
||||
binaryType = INVALID_INDEX,
|
||||
nameAndType.typeIndex,
|
||||
flags = 0,
|
||||
field.alignment
|
||||
)
|
||||
@@ -259,6 +260,9 @@ internal class KonanPartialModuleDeserializer(
|
||||
SerializedClassFieldInfo(
|
||||
field.name,
|
||||
primitiveBinaryType?.ordinal ?: INVALID_INDEX,
|
||||
if (with(KonanManglerIr) { (classifier as? IrClassSymbol)?.owner?.isExported(compatibleMode) } == false)
|
||||
INVALID_INDEX
|
||||
else nameAndType.typeIndex,
|
||||
flags,
|
||||
field.alignment
|
||||
)
|
||||
@@ -476,6 +480,7 @@ internal class KonanPartialModuleDeserializer(
|
||||
} else {
|
||||
val name = field.name
|
||||
val type = when {
|
||||
field.type != INVALID_INDEX -> declarationDeserializer.deserializeIrType(field.type)
|
||||
field.binaryType == INVALID_INDEX -> builtIns.anyNType
|
||||
else -> when (PrimitiveBinaryType.values().getOrNull(field.binaryType)) {
|
||||
PrimitiveBinaryType.BOOLEAN -> builtIns.booleanType
|
||||
|
||||
Reference in New Issue
Block a user