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)
@Argument(
value = "-Xdeserialize-fake-overrides",
description = "Fallback to deserializing fake overrides"
)
var deserializeFakeOverrides: Boolean by FreezableVar(false)
@Argument(
value = "-Xinference-compatibility",
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)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
put(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES, arguments.deserializeFakeOverrides)
val metadataVersionString = arguments.metadataVersion
if (metadataVersionString != null) {
@@ -48,9 +48,6 @@ object CommonConfigurationKeys {
@JvmField
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
@JvmField
val DESERIALIZE_FAKE_OVERRIDES = CompilerConfigurationKey.create<Boolean>("Deserialize fake overrides")
@JvmField
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 false: eligible fake overrides are not serialized.
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(
@@ -114,7 +114,6 @@ abstract class IrFileDeserializer(
val builtIns: IrBuiltIns,
val symbolTable: SymbolTable,
protected var deserializeBodies: Boolean,
private val deserializeFakeOverrides: Boolean,
private val fakeOverrideBuilder: FakeOverrideBuilder,
private val allowErrorNodes: Boolean
) {
@@ -1468,7 +1467,6 @@ abstract class IrFileDeserializer(
// Depending on deserialization strategy we either deserialize public api fake overrides
// or reconstruct them after IR linker completes.
private fun isSkippableFakeOverride(proto: ProtoDeclaration, parent: IrClass): Boolean {
if (deserializeFakeOverrides) return false
if (!platformFakeOverrideClassFilter.needToConstructFakeOverrides(parent)) return false
val symbol = when (proto.declaratorCase!!) {
@@ -52,8 +52,7 @@ abstract class KotlinIrLinker(
val logger: LoggingContext,
val builtIns: IrBuiltIns,
val symbolTable: SymbolTable,
private val exportedDependencies: List<ModuleDescriptor>,
private val deserializeFakeOverrides: Boolean
private val exportedDependencies: List<ModuleDescriptor>
) : IrDeserializer, FileLocalAwareLinker {
// Kotlin-MPP related data. Consider some refactoring
@@ -173,7 +172,6 @@ abstract class KotlinIrLinker(
fileIndex,
!strategy.needBodies,
strategy.inlineBodies,
deserializeFakeOverrides,
moduleDeserializer, allowErrorNodes
).apply {
@@ -236,7 +234,6 @@ abstract class KotlinIrLinker(
private val fileIndex: Int,
onlyHeaders: Boolean,
inlineBodies: Boolean,
deserializeFakeOverrides: Boolean,
private val moduleDeserializer: IrModuleDeserializer,
allowErrorNodes: Boolean
) :
@@ -245,7 +242,6 @@ abstract class KotlinIrLinker(
builtIns,
symbolTable,
!onlyHeaders,
deserializeFakeOverrides,
fakeOverrideBuilder,
allowErrorNodes
)
@@ -150,7 +150,6 @@ fun generateKLib(
irBuiltIns.functionFactory = functionFactory
val expectDescriptorToSymbol = mutableMapOf<DeclarationDescriptor, IrSymbol>()
val deserializeFakeOverrides = configuration.getBoolean(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES)
val feContext = psi2IrContext.run {
JsIrLinker.JsFePluginContext(moduleDescriptor, bindingContext, symbolTable, typeTranslator, irBuiltIns)
}
@@ -161,8 +160,7 @@ fun generateKLib(
psi2IrContext.symbolTable,
functionFactory,
feContext,
serializedIrFiles?.let { ICData(it, errorPolicy.allowErrors) },
deserializeFakeOverrides
serializedIrFiles?.let { ICData(it, errorPolicy.allowErrors) }
)
sortDependencies(allDependencies.getFullList(), depsDescriptors.descriptors).map {
@@ -227,7 +225,6 @@ fun loadIr(
irFactory: IrFactory,
): IrModuleInfo {
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
when (mainModule) {
@@ -240,7 +237,7 @@ fun loadIr(
val feContext = psi2IrContext.run {
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 {
irLinker.deserializeIrModuleHeader(depsDescriptors.getModuleDescriptor(it), it)
}
@@ -277,7 +274,7 @@ fun loadIr(
val irBuiltIns = IrBuiltIns(moduleDescriptor.builtIns, typeTranslator, symbolTable)
val functionFactory = IrFunctionFactory(irBuiltIns, symbolTable)
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 strategy =
@@ -27,9 +27,8 @@ class JsIrLinker(
private val currentModule: ModuleDescriptor?, logger: LoggingContext, builtIns: IrBuiltIns, symbolTable: SymbolTable,
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
override val translationPluginContext: TranslationPluginContext?,
private val icData: ICData? = null,
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
private val icData: ICData? = null
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
override val fakeOverrideBuilder = FakeOverrideBuilder(this, symbolTable, IdSignatureSerializer(JsManglerIr), builtIns)
@@ -41,9 +41,8 @@ class JvmIrLinker(
override val functionalInterfaceFactory: IrAbstractFunctionFactory,
override val translationPluginContext: TranslationPluginContext?,
private val stubGenerator: DeclarationStubGenerator,
private val manglerDesc: JvmManglerDesc,
deserializeFakeOverrides: Boolean = FakeOverrideControl.deserializeFakeOverrides
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList(), deserializeFakeOverrides) {
private val manglerDesc: JvmManglerDesc
) : KotlinIrLinker(currentModule, logger, builtIns, symbolTable, emptyList()) {
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
-Xcoroutines={enable|warn|error}
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
Do not enable scripting plugin by default
-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
-Xcoroutines={enable|warn|error}
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
Do not enable scripting plugin by default
-Xdisable-phases Disable backend phases