Eliminated -Xdeserialize-fake-overrides

This commit is contained in:
Alexander Gorshenev
2020-11-05 06:12:24 +03:00
parent b9c6267a63
commit 5de7a10df0
11 changed files with 8 additions and 36 deletions
@@ -352,12 +352,6 @@ 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)
@Argument( @Argument(
value = "-Xinference-compatibility", value = "-Xinference-compatibility",
description = "Enable compatibility changes for generic type inference algorithm" description = "Enable compatibility changes for generic type inference algorithm"
@@ -27,7 +27,6 @@ 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) {
@@ -48,9 +48,6 @@ 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")
@JvmField @JvmField
val USE_FIR_EXTENDED_CHECKERS = CompilerConfigurationKey.create<Boolean>("fir extended checkers") val USE_FIR_EXTENDED_CHECKERS = CompilerConfigurationKey.create<Boolean>("fir extended checkers")
} }
@@ -67,11 +67,6 @@ 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 = true val serializeFakeOverrides: Boolean = true
// If set to true: fake overrides are deserialized from klib serialized IR.
// 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
} }
class FakeOverrideBuilder( class FakeOverrideBuilder(
@@ -114,7 +114,6 @@ abstract class IrFileDeserializer(
val builtIns: IrBuiltIns, val builtIns: IrBuiltIns,
val symbolTable: SymbolTable, val symbolTable: SymbolTable,
protected var deserializeBodies: Boolean, protected var deserializeBodies: Boolean,
private val deserializeFakeOverrides: Boolean,
private val fakeOverrideBuilder: FakeOverrideBuilder, private val fakeOverrideBuilder: FakeOverrideBuilder,
private val allowErrorNodes: Boolean private val allowErrorNodes: Boolean
) { ) {
@@ -1468,7 +1467,6 @@ abstract class IrFileDeserializer(
// 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, parent: IrClass): Boolean { private fun isSkippableFakeOverride(proto: ProtoDeclaration, parent: IrClass): Boolean {
if (deserializeFakeOverrides) return false
if (!platformFakeOverrideClassFilter.needToConstructFakeOverrides(parent)) return false if (!platformFakeOverrideClassFilter.needToConstructFakeOverrides(parent)) return false
val symbol = when (proto.declaratorCase!!) { val symbol = when (proto.declaratorCase!!) {
@@ -52,8 +52,7 @@ 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, FileLocalAwareLinker { ) : IrDeserializer, FileLocalAwareLinker {
// Kotlin-MPP related data. Consider some refactoring // Kotlin-MPP related data. Consider some refactoring
@@ -173,7 +172,6 @@ abstract class KotlinIrLinker(
fileIndex, fileIndex,
!strategy.needBodies, !strategy.needBodies,
strategy.inlineBodies, strategy.inlineBodies,
deserializeFakeOverrides,
moduleDeserializer, allowErrorNodes moduleDeserializer, allowErrorNodes
).apply { ).apply {
@@ -236,7 +234,6 @@ abstract class KotlinIrLinker(
private val fileIndex: Int, private val fileIndex: Int,
onlyHeaders: Boolean, onlyHeaders: Boolean,
inlineBodies: Boolean, inlineBodies: Boolean,
deserializeFakeOverrides: Boolean,
private val moduleDeserializer: IrModuleDeserializer, private val moduleDeserializer: IrModuleDeserializer,
allowErrorNodes: Boolean allowErrorNodes: Boolean
) : ) :
@@ -245,7 +242,6 @@ abstract class KotlinIrLinker(
builtIns, builtIns,
symbolTable, symbolTable,
!onlyHeaders, !onlyHeaders,
deserializeFakeOverrides,
fakeOverrideBuilder, fakeOverrideBuilder,
allowErrorNodes allowErrorNodes
) )
@@ -150,7 +150,6 @@ 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 feContext = psi2IrContext.run { val feContext = psi2IrContext.run {
JsIrLinker.JsFePluginContext(moduleDescriptor, bindingContext, symbolTable, typeTranslator, irBuiltIns) JsIrLinker.JsFePluginContext(moduleDescriptor, bindingContext, symbolTable, typeTranslator, irBuiltIns)
} }
@@ -161,8 +160,7 @@ fun generateKLib(
psi2IrContext.symbolTable, psi2IrContext.symbolTable,
functionFactory, functionFactory,
feContext, feContext,
serializedIrFiles?.let { ICData(it, errorPolicy.allowErrors) }, serializedIrFiles?.let { ICData(it, errorPolicy.allowErrors) }
deserializeFakeOverrides
) )
sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map { sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
@@ -227,7 +225,6 @@ fun loadIr(
irFactory: IrFactory, irFactory: IrFactory,
): 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)
val errorPolicy = configuration.get(JSConfigurationKeys.ERROR_TOLERANCE_POLICY) ?: ErrorTolerancePolicy.DEFAULT val errorPolicy = configuration.get(JSConfigurationKeys.ERROR_TOLERANCE_POLICY) ?: ErrorTolerancePolicy.DEFAULT
when (mainModule) { when (mainModule) {
@@ -240,7 +237,7 @@ fun loadIr(
val feContext = psi2IrContext.run { val feContext = psi2IrContext.run {
JsIrLinker.JsFePluginContext(moduleDescriptor, bindingContext, symbolTable, typeTranslator, irBuiltIns) JsIrLinker.JsFePluginContext(moduleDescriptor, bindingContext, symbolTable, typeTranslator, irBuiltIns)
} }
val irLinker = JsIrLinker(psi2IrContext.moduleDescriptor, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, feContext, null, deserializeFakeOverrides) val irLinker = JsIrLinker(psi2IrContext.moduleDescriptor, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, feContext, 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)
} }
@@ -277,7 +274,7 @@ fun loadIr(
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 = val irLinker =
JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null, null, deserializeFakeOverrides) JsIrLinker(null, emptyLoggingContext, irBuiltIns, symbolTable, functionFactory, null, null)
val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map { val deserializedModuleFragments = sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
val strategy = val strategy =
@@ -27,9 +27,8 @@ 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,
override val translationPluginContext: TranslationPluginContext?, override val translationPluginContext: TranslationPluginContext?,
private val icData: ICData? = null, private val icData: ICData? = null
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides ) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(JsManglerIr), builtIns) override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(JsManglerIr), builtIns)
@@ -41,9 +41,8 @@ class JvmIrLinker(
override val functionalInterfaceFactory: IrAbstractFunctionFactory, override val functionalInterfaceFactory: IrAbstractFunctionFactory,
override val translationPluginContext: TranslationPluginContext?, override val translationPluginContext: TranslationPluginContext?,
private val stubGenerator: DeclarationStubGenerator, private val stubGenerator: DeclarationStubGenerator,
private val manglerDesc: JvmManglerDesc, private val manglerDesc: JvmManglerDesc
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides ) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(JvmManglerIr), builtIns) override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(JvmManglerIr), builtIns)
-1
View File
@@ -30,7 +30,6 @@ where advanced options include:
Should be a subset of sources passed as free arguments Should be a subset of sources passed as free arguments
-Xcoroutines={enable|warn|error} -Xcoroutines={enable|warn|error}
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
-Xdeserialize-fake-overrides Fallback to deserializing fake overrides
-Xdisable-default-scripting-plugin -Xdisable-default-scripting-plugin
Do not enable scripting plugin by default Do not enable scripting plugin by default
-Xdisable-phases Disable backend phases -Xdisable-phases Disable backend phases
-1
View File
@@ -123,7 +123,6 @@ where advanced options include:
Should be a subset of sources passed as free arguments Should be a subset of sources passed as free arguments
-Xcoroutines={enable|warn|error} -Xcoroutines={enable|warn|error}
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
-Xdeserialize-fake-overrides Fallback to deserializing fake overrides
-Xdisable-default-scripting-plugin -Xdisable-default-scripting-plugin
Do not enable scripting plugin by default Do not enable scripting plugin by default
-Xdisable-phases Disable backend phases -Xdisable-phases Disable backend phases