[KLIB] Keep order of constant properties depending on backend

- Fix K/N performance regression
This commit is contained in:
Roman Artemev
2019-12-02 14:37:58 +03:00
committed by romanart
parent 6ef3831f14
commit ca0bff75cd
2 changed files with 8 additions and 2 deletions
@@ -1269,6 +1269,7 @@ open class IrFileSerializer(
open fun backendSpecificExplicitRoot(declaration: IrFunction) = false
open fun backendSpecificExplicitRoot(declaration: IrClass) = false
open fun keepOrderOfProperties(property: IrProperty): Boolean = !property.isConst
fun serializeIrFile(file: IrFile): SerializedIrFile {
val topLevelDeclarations = mutableListOf<SerializedDeclaration>()
@@ -1297,7 +1298,7 @@ open class IrFileSerializer(
// Make sure that all top level properties are initialized on library's load.
file.declarations
.filterIsInstance<IrProperty>()
.filter { it.backingField?.initializer != null }
.filter { it.backingField?.initializer != null && keepOrderOfProperties(it) }
.forEach { proto.addExplicitlyExportedToCompiler(serializeIrSymbol(it.backingField!!.symbol)) }
// TODO: Konan specific