Fake override construction fallback mode
This commit is contained in:
+6
@@ -340,6 +340,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
)
|
)
|
||||||
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
|
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
|
||||||
|
|
||||||
|
@Argument(
|
||||||
|
value = "-Xdeserialize-fake-overrides",
|
||||||
|
description = "Fallback to deserializing fake overrides"
|
||||||
|
)
|
||||||
|
var deserializeFakeOverrides: Boolean by FreezableVar(false)
|
||||||
|
|
||||||
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||||
return HashMap<AnalysisFlag<*>, Any>().apply {
|
return HashMap<AnalysisFlag<*>, Any>().apply {
|
||||||
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
|
|||||||
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
|
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
|
||||||
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
|
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
|
||||||
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
|
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
|
||||||
|
put(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES, arguments.deserializeFakeOverrides)
|
||||||
|
|
||||||
val metadataVersionString = arguments.metadataVersion
|
val metadataVersionString = arguments.metadataVersion
|
||||||
if (metadataVersionString != null) {
|
if (metadataVersionString != null) {
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ object CommonConfigurationKeys {
|
|||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
|
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val DESERIALIZE_FAKE_OVERRIDES = CompilerConfigurationKey.create<Boolean>("Deserialize fake overrides")
|
||||||
}
|
}
|
||||||
|
|
||||||
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
|
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
|
||||||
|
|||||||
+5
-10
@@ -39,10 +39,6 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
|||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
interface FakeOverrideBuilder {
|
|
||||||
fun buildFakeOverridesForClass(clazz: IrClass)
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PlatformFakeOverrideClassFilter {
|
interface PlatformFakeOverrideClassFilter {
|
||||||
fun constructFakeOverrides(clazz: IrClass): Boolean = true
|
fun constructFakeOverrides(clazz: IrClass): Boolean = true
|
||||||
}
|
}
|
||||||
@@ -52,19 +48,20 @@ object DefaultFakeOverrideClassFilter : PlatformFakeOverrideClassFilter
|
|||||||
object FakeOverrideControl {
|
object FakeOverrideControl {
|
||||||
// If set to true: all fake overrides go to klib serialized IR.
|
// If set to true: all fake overrides go to klib serialized IR.
|
||||||
// If set to false: eligible fake overrides are not serialized.
|
// If set to false: eligible fake overrides are not serialized.
|
||||||
val serializeFakeOverrides: Boolean = false
|
val serializeFakeOverrides: Boolean = true
|
||||||
|
|
||||||
// If set to true: fake overrides are deserialized from klib serialized IR.
|
// If set to true: fake overrides are deserialized from klib serialized IR.
|
||||||
// If set to false: eligible fake overrides are constructed within IR linker.
|
// If set to false: eligible fake overrides are constructed within IR linker.
|
||||||
|
// This is the default in the absence of -Xdeserialize-fake-overrides flag.
|
||||||
val deserializeFakeOverrides: Boolean = false
|
val deserializeFakeOverrides: Boolean = false
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakeOverrideBuilderImpl(
|
class FakeOverrideBuilder(
|
||||||
val symbolTable: SymbolTable,
|
val symbolTable: SymbolTable,
|
||||||
val signaturer: IdSignatureSerializer,
|
val signaturer: IdSignatureSerializer,
|
||||||
val irBuiltIns: IrBuiltIns,
|
val irBuiltIns: IrBuiltIns,
|
||||||
private val platformSpecificClassFilter: PlatformFakeOverrideClassFilter = DefaultFakeOverrideClassFilter
|
val platformSpecificClassFilter: PlatformFakeOverrideClassFilter = DefaultFakeOverrideClassFilter
|
||||||
) : FakeOverrideBuilder, FakeOverrideBuilderStrategy {
|
) : FakeOverrideBuilderStrategy {
|
||||||
private val haveFakeOverrides = mutableSetOf<IrClass>()
|
private val haveFakeOverrides = mutableSetOf<IrClass>()
|
||||||
override val propertyOverriddenSymbols = mutableMapOf<IrOverridableMember, List<IrSymbol>>()
|
override val propertyOverriddenSymbols = mutableMapOf<IrOverridableMember, List<IrSymbol>>()
|
||||||
private val irOverridingUtil = IrOverridingUtil(irBuiltIns, this)
|
private val irOverridingUtil = IrOverridingUtil(irBuiltIns, this)
|
||||||
@@ -117,8 +114,6 @@ class FakeOverrideBuilderImpl(
|
|||||||
irOverridingUtil.buildFakeOverridesForClass(clazz)
|
irOverridingUtil.buildFakeOverridesForClass(clazz)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildFakeOverridesForClass(clazz: IrClass) = irOverridingUtil.buildFakeOverridesForClass(clazz)
|
|
||||||
|
|
||||||
override fun linkFakeOverride(fakeOverride: IrOverridableMember) {
|
override fun linkFakeOverride(fakeOverride: IrOverridableMember) {
|
||||||
when (fakeOverride) {
|
when (fakeOverride) {
|
||||||
is IrFakeOverrideFunctionImpl -> linkFunctionFakeOverride(fakeOverride)
|
is IrFakeOverrideFunctionImpl -> linkFunctionFakeOverride(fakeOverride)
|
||||||
|
|||||||
+26
-14
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.common.serialization
|
|||||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||||
import org.jetbrains.kotlin.backend.common.ir.DeclarationFactory
|
import org.jetbrains.kotlin.backend.common.ir.DeclarationFactory
|
||||||
import org.jetbrains.kotlin.backend.common.ir.ir2string
|
import org.jetbrains.kotlin.backend.common.ir.ir2string
|
||||||
|
import org.jetbrains.kotlin.backend.common.overrides.PlatformFakeOverrideClassFilter
|
||||||
import org.jetbrains.kotlin.backend.common.peek
|
import org.jetbrains.kotlin.backend.common.peek
|
||||||
import org.jetbrains.kotlin.backend.common.pop
|
import org.jetbrains.kotlin.backend.common.pop
|
||||||
import org.jetbrains.kotlin.backend.common.push
|
import org.jetbrains.kotlin.backend.common.push
|
||||||
@@ -27,6 +28,7 @@ import org.jetbrains.kotlin.ir.descriptors.*
|
|||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
|
import org.jetbrains.kotlin.ir.symbols.impl.IrPublicSymbolBase
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.impl.*
|
import org.jetbrains.kotlin.ir.types.impl.*
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
@@ -103,7 +105,13 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.Loop as ProtoLoop
|
|||||||
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
|
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
|
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
|
||||||
|
|
||||||
abstract class IrFileDeserializer(val logger: LoggingContext, val builtIns: IrBuiltIns, val symbolTable: SymbolTable, var constructFakeOverrides: Boolean, protected var deserializeBodies: Boolean) {
|
abstract class IrFileDeserializer(
|
||||||
|
val logger: LoggingContext,
|
||||||
|
val builtIns: IrBuiltIns,
|
||||||
|
val symbolTable: SymbolTable,
|
||||||
|
protected var deserializeBodies: Boolean,
|
||||||
|
private val deserializeFakeOverrides: Boolean
|
||||||
|
) {
|
||||||
|
|
||||||
abstract fun deserializeIrSymbolToDeclare(code: Long): Pair<IrSymbol, IdSignature>
|
abstract fun deserializeIrSymbolToDeclare(code: Long): Pair<IrSymbol, IdSignature>
|
||||||
abstract fun deserializeIrSymbol(code: Long): IrSymbol
|
abstract fun deserializeIrSymbol(code: Long): IrSymbol
|
||||||
@@ -120,6 +128,7 @@ abstract class IrFileDeserializer(val logger: LoggingContext, val builtIns: IrBu
|
|||||||
private val delegatedSymbolMap = mutableMapOf<IrSymbol, IrSymbol>()
|
private val delegatedSymbolMap = mutableMapOf<IrSymbol, IrSymbol>()
|
||||||
|
|
||||||
abstract val deserializeInlineFunctions: Boolean
|
abstract val deserializeInlineFunctions: Boolean
|
||||||
|
abstract val platformFakeOverrideClassFilter: PlatformFakeOverrideClassFilter
|
||||||
|
|
||||||
fun deserializeFqName(fqn: List<Int>): String =
|
fun deserializeFqName(fqn: List<Int>): String =
|
||||||
fqn.joinToString(".", transform = ::deserializeString)
|
fqn.joinToString(".", transform = ::deserializeString)
|
||||||
@@ -1033,14 +1042,14 @@ abstract class IrFileDeserializer(val logger: LoggingContext, val builtIns: IrBu
|
|||||||
}.usingParent {
|
}.usingParent {
|
||||||
typeParameters = deserializeTypeParameters(proto.typeParameterList, true)
|
typeParameters = deserializeTypeParameters(proto.typeParameterList, true)
|
||||||
|
|
||||||
|
superTypes = proto.superTypeList.map { deserializeIrType(it) }
|
||||||
|
|
||||||
proto.declarationList
|
proto.declarationList
|
||||||
//.filterNot { isSkippableFakeOverride(it) }
|
.filterNot { isSkippableFakeOverride(it, this) }
|
||||||
.mapTo(declarations) { deserializeDeclaration(it) }
|
.mapTo(declarations) { deserializeDeclaration(it) }
|
||||||
|
|
||||||
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)
|
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)
|
||||||
|
|
||||||
superTypes = proto.superTypeList.map { deserializeIrType(it) }
|
|
||||||
|
|
||||||
(descriptor as? WrappedClassDescriptor)?.bind(this)
|
(descriptor as? WrappedClassDescriptor)?.bind(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1361,22 +1370,25 @@ abstract class IrFileDeserializer(val logger: LoggingContext, val builtIns: IrBu
|
|||||||
|
|
||||||
// Depending on deserialization strategy we either deserialize public api fake overrides
|
// Depending on deserialization strategy we either deserialize public api fake overrides
|
||||||
// or reconstruct them after IR linker completes.
|
// or reconstruct them after IR linker completes.
|
||||||
private fun isSkippableFakeOverride(proto: ProtoDeclaration): Boolean {
|
private fun isSkippableFakeOverride(proto: ProtoDeclaration, parent: IrClass): Boolean {
|
||||||
if (!constructFakeOverrides) return false
|
if (deserializeFakeOverrides) return false
|
||||||
|
if (!platformFakeOverrideClassFilter.constructFakeOverrides(parent)) return false
|
||||||
|
|
||||||
val isFakeOverride = when (proto.declaratorCase!!) {
|
val symbol = when (proto.declaratorCase!!) {
|
||||||
|
IR_FUNCTION -> deserializeIrSymbol(proto.irFunction.base.base.symbol)
|
||||||
|
IR_PROPERTY -> deserializeIrSymbol(proto.irProperty.base.symbol)
|
||||||
|
// Don't consider IR_FIELDS here.
|
||||||
|
else -> return false
|
||||||
|
}
|
||||||
|
if (symbol !is IrPublicSymbolBase<*>) return false
|
||||||
|
if (!symbol.signature.isPublic) return false
|
||||||
|
|
||||||
|
return when (proto.declaratorCase!!) {
|
||||||
IR_FUNCTION -> FunctionFlags.decode(proto.irFunction.base.base.flags).isFakeOverride
|
IR_FUNCTION -> FunctionFlags.decode(proto.irFunction.base.base.flags).isFakeOverride
|
||||||
IR_PROPERTY -> PropertyFlags.decode(proto.irProperty.base.flags).isFakeOverride
|
IR_PROPERTY -> PropertyFlags.decode(proto.irProperty.base.flags).isFakeOverride
|
||||||
// Don't consider IR_FIELDS here.
|
// Don't consider IR_FIELDS here.
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
val isPublicApi = when (proto.declaratorCase!!) {
|
|
||||||
IR_FUNCTION -> deserializeIrSymbol(proto.irFunction.base.base.symbol).signature.isPublic
|
|
||||||
IR_PROPERTY -> deserializeIrSymbol(proto.irProperty.base.symbol).signature.isPublic
|
|
||||||
// Don't consider IR_FIELDS here.
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
return isFakeOverride && isPublicApi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deserializeDeclaration(proto: ProtoDeclaration, parent: IrDeclarationParent) =
|
fun deserializeDeclaration(proto: ProtoDeclaration, parent: IrDeclarationParent) =
|
||||||
|
|||||||
+16
-12
@@ -6,7 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.common.serialization
|
package org.jetbrains.kotlin.backend.common.serialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilderImpl
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideControl
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideControl
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
@@ -54,7 +54,8 @@ abstract class KotlinIrLinker(
|
|||||||
val logger: LoggingContext,
|
val logger: LoggingContext,
|
||||||
val builtIns: IrBuiltIns,
|
val builtIns: IrBuiltIns,
|
||||||
val symbolTable: SymbolTable,
|
val symbolTable: SymbolTable,
|
||||||
private val exportedDependencies: List<ModuleDescriptor>
|
private val exportedDependencies: List<ModuleDescriptor>,
|
||||||
|
private val deserializeFakeOverrides: Boolean
|
||||||
) : IrDeserializer {
|
) : IrDeserializer {
|
||||||
|
|
||||||
// Kotlin-MPP related data. Consider some refactoring
|
// Kotlin-MPP related data. Consider some refactoring
|
||||||
@@ -67,7 +68,7 @@ abstract class KotlinIrLinker(
|
|||||||
|
|
||||||
protected val deserializersForModules = mutableMapOf<ModuleDescriptor, IrModuleDeserializer>()
|
protected val deserializersForModules = mutableMapOf<ModuleDescriptor, IrModuleDeserializer>()
|
||||||
|
|
||||||
abstract val fakeOverrideBuilderImpl: FakeOverrideBuilderImpl
|
abstract val fakeOverrideBuilder: FakeOverrideBuilder
|
||||||
|
|
||||||
private val haveSeen = mutableSetOf<IrSymbol>()
|
private val haveSeen = mutableSetOf<IrSymbol>()
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ abstract class KotlinIrLinker(
|
|||||||
fileIndex,
|
fileIndex,
|
||||||
!strategy.needBodies,
|
!strategy.needBodies,
|
||||||
strategy.inlineBodies,
|
strategy.inlineBodies,
|
||||||
!strategy.fakeOverrides,
|
deserializeFakeOverrides,
|
||||||
moduleDeserializer).apply {
|
moduleDeserializer).apply {
|
||||||
|
|
||||||
// Explicitly exported declarations (e.g. top-level initializers) must be deserialized before all other declarations.
|
// Explicitly exported declarations (e.g. top-level initializers) must be deserialized before all other declarations.
|
||||||
@@ -225,9 +226,9 @@ abstract class KotlinIrLinker(
|
|||||||
private val fileIndex: Int,
|
private val fileIndex: Int,
|
||||||
onlyHeaders: Boolean,
|
onlyHeaders: Boolean,
|
||||||
inlineBodies: Boolean,
|
inlineBodies: Boolean,
|
||||||
constructFakeOverrrides: Boolean,
|
deserializeFakeOverrides: Boolean,
|
||||||
private val moduleDeserializer: IrModuleDeserializer,
|
private val moduleDeserializer: IrModuleDeserializer
|
||||||
) : IrFileDeserializer(logger, builtIns, symbolTable, constructFakeOverrrides, !onlyHeaders) {
|
) : IrFileDeserializer(logger, builtIns, symbolTable, !onlyHeaders, deserializeFakeOverrides) {
|
||||||
|
|
||||||
private var fileLoops = mutableMapOf<Int, IrLoopBase>()
|
private var fileLoops = mutableMapOf<Int, IrLoopBase>()
|
||||||
|
|
||||||
@@ -237,6 +238,8 @@ abstract class KotlinIrLinker(
|
|||||||
|
|
||||||
override val deserializeInlineFunctions: Boolean = inlineBodies
|
override val deserializeInlineFunctions: Boolean = inlineBodies
|
||||||
|
|
||||||
|
override val platformFakeOverrideClassFilter = fakeOverrideBuilder.platformSpecificClassFilter
|
||||||
|
|
||||||
var reversedSignatureIndex = emptyMap<IdSignature, Int>()
|
var reversedSignatureIndex = emptyMap<IdSignature, Int>()
|
||||||
|
|
||||||
inner class FileDeserializationState {
|
inner class FileDeserializationState {
|
||||||
@@ -586,9 +589,11 @@ abstract class KotlinIrLinker(
|
|||||||
override fun postProcess() {
|
override fun postProcess() {
|
||||||
finalizeExpectActualLinker()
|
finalizeExpectActualLinker()
|
||||||
|
|
||||||
deserializersForModules.values.forEach {
|
if (!deserializeFakeOverrides) {
|
||||||
it.postProcess {
|
deserializersForModules.values.forEach {
|
||||||
fakeOverrideBuilderImpl.provideFakeOverrides(it)
|
it.postProcess {
|
||||||
|
fakeOverrideBuilder.provideFakeOverrides(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,8 +681,7 @@ enum class DeserializationStrategy(
|
|||||||
val needBodies: Boolean,
|
val needBodies: Boolean,
|
||||||
val explicitlyExported: Boolean,
|
val explicitlyExported: Boolean,
|
||||||
val theWholeWorld: Boolean,
|
val theWholeWorld: Boolean,
|
||||||
val inlineBodies: Boolean,
|
val inlineBodies: Boolean
|
||||||
val fakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides
|
|
||||||
) {
|
) {
|
||||||
ONLY_REFERENCED(true, false, false, true),
|
ONLY_REFERENCED(true, false, false, true),
|
||||||
ALL(true, true, true, true),
|
ALL(true, true, true, true),
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ fun generateKLib(
|
|||||||
irBuiltIns.functionFactory = functionFactory
|
irBuiltIns.functionFactory = functionFactory
|
||||||
|
|
||||||
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
|
||||||
|
val deserializeFakeOverrides = configuration.getBoolean(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES)
|
||||||
|
|
||||||
val irLinker = JsIrLinker(
|
val irLinker = JsIrLinker(
|
||||||
psi2IrContext.moduleDescriptor,
|
psi2IrContext.moduleDescriptor,
|
||||||
@@ -154,7 +155,8 @@ fun generateKLib(
|
|||||||
psi2IrContext.irBuiltIns,
|
psi2IrContext.irBuiltIns,
|
||||||
psi2IrContext.symbolTable,
|
psi2IrContext.symbolTable,
|
||||||
functionFactory,
|
functionFactory,
|
||||||
serializedIrFiles
|
serializedIrFiles,
|
||||||
|
deserializeFakeOverrides
|
||||||
)
|
)
|
||||||
|
|
||||||
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
||||||
@@ -216,6 +218,7 @@ fun loadIr(
|
|||||||
friendDependencies: List<KotlinLibrary>
|
friendDependencies: List<KotlinLibrary>
|
||||||
): IrModuleInfo {
|
): IrModuleInfo {
|
||||||
val depsDescriptors = ModulesStructure(project, mainModule, analyzer, configuration, allDependencies, friendDependencies)
|
val depsDescriptors = ModulesStructure(project, mainModule, analyzer, configuration, allDependencies, friendDependencies)
|
||||||
|
val deserializeFakeOverrides = configuration.getBoolean(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES)
|
||||||
|
|
||||||
when (mainModule) {
|
when (mainModule) {
|
||||||
is MainModule.SourceFiles -> {
|
is MainModule.SourceFiles -> {
|
||||||
@@ -224,9 +227,7 @@ fun loadIr(
|
|||||||
val symbolTable = psi2IrContext.symbolTable
|
val symbolTable = psi2IrContext.symbolTable
|
||||||
val functionFactory = IrFunctionFactory(irBuiltIns, symbolTable)
|
val functionFactory = IrFunctionFactory(irBuiltIns, symbolTable)
|
||||||
irBuiltIns.functionFactory = functionFactory
|
irBuiltIns.functionFactory = functionFactory
|
||||||
|
val irLinker = JsIrLinker(psi2IrContext.moduleDescriptor, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null, deserializeFakeOverrides)
|
||||||
val irLinker = JsIrLinker(psi2IrContext.moduleDescriptor, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null)
|
|
||||||
|
|
||||||
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
||||||
irLinker.deserializeIrModuleHeader(depsDescriptors.getModuleDescriptor(it), it)
|
irLinker.deserializeIrModuleHeader(depsDescriptors.getModuleDescriptor(it), it)
|
||||||
}
|
}
|
||||||
@@ -262,7 +263,7 @@ fun loadIr(
|
|||||||
constantValueGenerator.typeTranslator = typeTranslator
|
constantValueGenerator.typeTranslator = typeTranslator
|
||||||
val irBuiltIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
val irBuiltIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||||
val functionFactory = IrFunctionFactory(irBuiltIns, symbolTable)
|
val functionFactory = IrFunctionFactory(irBuiltIns, symbolTable)
|
||||||
val irLinker = JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null)
|
val irLinker = JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null, deserializeFakeOverrides)
|
||||||
|
|
||||||
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
|
||||||
val strategy =
|
val strategy =
|
||||||
|
|||||||
+6
-5
@@ -6,7 +6,8 @@
|
|||||||
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilderImpl
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||||
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideControl
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureSerializer
|
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureSerializer
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
@@ -20,11 +21,11 @@ import org.jetbrains.kotlin.library.SerializedIrFile
|
|||||||
class JsIrLinker(
|
class JsIrLinker(
|
||||||
private val currentModule: ModuleDescriptor?, logger: LoggingContext, builtIns: IrBuiltIns, symbolTable: SymbolTable,
|
private val currentModule: ModuleDescriptor?, logger: LoggingContext, builtIns: IrBuiltIns, symbolTable: SymbolTable,
|
||||||
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
|
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
|
||||||
private val icData: List<SerializedIrFile>? = null
|
private val icData: List<SerializedIrFile>? = null,
|
||||||
) :
|
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides
|
||||||
KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
|
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
|
||||||
|
|
||||||
override val fakeOverrideBuilderImpl = FakeOverrideBuilderImpl(symbolTable, IdSignatureSerializer(JsManglerIr), builtIns)
|
override val fakeOverrideBuilder = FakeOverrideBuilder(symbolTable, IdSignatureSerializer(JsManglerIr), builtIns)
|
||||||
|
|
||||||
override fun isBuiltInModule(moduleDescriptor: ModuleDescriptor): Boolean =
|
override fun isBuiltInModule(moduleDescriptor: ModuleDescriptor): Boolean =
|
||||||
moduleDescriptor === moduleDescriptor.builtIns.builtInsModule
|
moduleDescriptor === moduleDescriptor.builtIns.builtInsModule
|
||||||
|
|||||||
+6
-4
@@ -6,7 +6,8 @@
|
|||||||
package org.jetbrains.kotlin.ir.backend.jvm.serialization
|
package org.jetbrains.kotlin.ir.backend.jvm.serialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilderImpl
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||||
|
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideControl
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureSerializer
|
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureSerializer
|
||||||
@@ -37,10 +38,11 @@ class JvmIrLinker(
|
|||||||
symbolTable: SymbolTable,
|
symbolTable: SymbolTable,
|
||||||
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
|
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
|
||||||
private val stubGenerator: DeclarationStubGenerator,
|
private val stubGenerator: DeclarationStubGenerator,
|
||||||
private val manglerDesc: JvmManglerDesc
|
private val manglerDesc: JvmManglerDesc,
|
||||||
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
|
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides
|
||||||
|
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
|
||||||
|
|
||||||
override val fakeOverrideBuilderImpl = FakeOverrideBuilderImpl(symbolTable, IdSignatureSerializer(JvmManglerIr), builtIns)
|
override val fakeOverrideBuilder = FakeOverrideBuilder(symbolTable, IdSignatureSerializer(JvmManglerIr), builtIns)
|
||||||
|
|
||||||
private val javaName = Name.identifier("java")
|
private val javaName = Name.identifier("java")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user