[KLIB] Keep order of constant properties depending on backend
- Fix K/N performance regression
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
+6
-1
@@ -8,9 +8,14 @@ package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||
import org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
||||
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
||||
|
||||
class JsIrFileSerializer(
|
||||
logger: LoggingContext,
|
||||
declarationTable: DeclarationTable,
|
||||
bodiesOnlyForInlines: Boolean = false
|
||||
) : IrFileSerializer(logger, declarationTable, bodiesOnlyForInlines)
|
||||
) : IrFileSerializer(logger, declarationTable, bodiesOnlyForInlines) {
|
||||
|
||||
// Temporary keep order of any property, even of constants
|
||||
override fun keepOrderOfProperties(property: IrProperty): Boolean = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user