JVM IR: remove obsolete -Xir-check-local-names
This flag was added a long time ago, at the time when we weren't sure if we were going to keep the naming of local and anonymous classes completely equal to the naming in the old backend. Now that we've decided that we won't keep it equal and there are a lot of differences already, it's not useful anymore.
This commit is contained in:
committed by
Alexander Udalov
parent
acd29481bd
commit
ee2ae0c471
@@ -108,7 +108,7 @@ class GenerationState private constructor(
|
|||||||
fun wantsDiagnostics(v: Boolean) =
|
fun wantsDiagnostics(v: Boolean) =
|
||||||
apply { wantsDiagnostics = v }
|
apply { wantsDiagnostics = v }
|
||||||
|
|
||||||
var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module); private set
|
private var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module)
|
||||||
fun jvmBackendClassResolver(v: JvmBackendClassResolver) =
|
fun jvmBackendClassResolver(v: JvmBackendClassResolver) =
|
||||||
apply { jvmBackendClassResolver = v }
|
apply { jvmBackendClassResolver = v }
|
||||||
|
|
||||||
@@ -153,8 +153,10 @@ class GenerationState private constructor(
|
|||||||
val deserializationConfiguration: DeserializationConfiguration =
|
val deserializationConfiguration: DeserializationConfiguration =
|
||||||
CompilerDeserializationConfiguration(configuration.languageVersionSettings)
|
CompilerDeserializationConfiguration(configuration.languageVersionSettings)
|
||||||
|
|
||||||
val deprecationProvider =
|
val deprecationProvider = DeprecationResolver(
|
||||||
DeprecationResolver(LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, JavaDeprecationSettings)
|
LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED,
|
||||||
|
JavaDeprecationSettings
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
|
val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
|
||||||
@@ -250,6 +252,7 @@ class GenerationState private constructor(
|
|||||||
class ForScript {
|
class ForScript {
|
||||||
// quite a mess, this one is an input from repl interpreter
|
// quite a mess, this one is an input from repl interpreter
|
||||||
var earlierScriptsForReplInterpreter: List<ScriptDescriptor>? = null
|
var earlierScriptsForReplInterpreter: List<ScriptDescriptor>? = null
|
||||||
|
|
||||||
// and the rest is an output from the codegen
|
// and the rest is an output from the codegen
|
||||||
var resultFieldName: String? = null
|
var resultFieldName: String? = null
|
||||||
var resultTypeString: String? = null
|
var resultTypeString: String? = null
|
||||||
@@ -346,7 +349,7 @@ class GenerationState private constructor(
|
|||||||
fun beforeCompile() {
|
fun beforeCompile() {
|
||||||
markUsed()
|
markUsed()
|
||||||
|
|
||||||
if (!isIrBackend || languageVersionSettings.getFlag(JvmAnalysisFlags.irCheckLocalNames)) {
|
if (!isIrBackend) {
|
||||||
CodegenBinding.initTrace(this)
|
CodegenBinding.initTrace(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -88,12 +88,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
|||||||
@Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default")
|
@Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default")
|
||||||
var noUseIR: Boolean by FreezableVar(false)
|
var noUseIR: Boolean by FreezableVar(false)
|
||||||
|
|
||||||
@Argument(
|
|
||||||
value = "-Xir-check-local-names",
|
|
||||||
description = "Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend"
|
|
||||||
)
|
|
||||||
var irCheckLocalNames: Boolean by FreezableVar(false)
|
|
||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
value = "-Xallow-unstable-dependencies",
|
value = "-Xallow-unstable-dependencies",
|
||||||
description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler"
|
description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler"
|
||||||
@@ -446,7 +440,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
|||||||
result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts
|
result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts
|
||||||
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
|
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
|
||||||
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
|
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
|
||||||
result[JvmAnalysisFlags.irCheckLocalNames] = irCheckLocalNames
|
|
||||||
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
|
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
|
||||||
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
|
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
|
||||||
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
|
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ object JvmAnalysisFlags {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val suppressMissingBuiltinsError by AnalysisFlag.Delegates.Boolean
|
val suppressMissingBuiltinsError by AnalysisFlag.Delegates.Boolean
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
val irCheckLocalNames by AnalysisFlag.Delegates.Boolean
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean
|
val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean
|
||||||
|
|
||||||
|
|||||||
@@ -374,8 +374,6 @@ private val jvmFilePhases = listOf(
|
|||||||
replaceKFunctionInvokeWithFunctionInvokePhase,
|
replaceKFunctionInvokeWithFunctionInvokePhase,
|
||||||
kotlinNothingValueExceptionPhase,
|
kotlinNothingValueExceptionPhase,
|
||||||
|
|
||||||
checkLocalNamesWithOldBackendPhase,
|
|
||||||
|
|
||||||
renameFieldsPhase,
|
renameFieldsPhase,
|
||||||
fakeInliningLocalVariablesLowering,
|
fakeInliningLocalVariablesLowering,
|
||||||
|
|
||||||
|
|||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.jvm.lower
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
|
||||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
|
||||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
|
||||||
import org.jetbrains.kotlin.ir.util.render
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
|
||||||
|
|
||||||
val checkLocalNamesWithOldBackendPhase = makeIrFilePhase<JvmBackendContext>(
|
|
||||||
{ context ->
|
|
||||||
if (context.state.languageVersionSettings.getFlag(JvmAnalysisFlags.irCheckLocalNames))
|
|
||||||
CheckLocalNamesWithOldBackend(context)
|
|
||||||
else
|
|
||||||
FileLoweringPass.Empty
|
|
||||||
},
|
|
||||||
name = "CheckLocalNamesWithOldBackend",
|
|
||||||
description = "With -Xir-check-local-names, check that names for local classes and anonymous objects are the same in the IR backend as in the old backend"
|
|
||||||
)
|
|
||||||
|
|
||||||
class CheckLocalNamesWithOldBackend(private val context: JvmBackendContext) : FileLoweringPass, IrElementVisitorVoid {
|
|
||||||
override fun lower(irFile: IrFile) {
|
|
||||||
irFile.acceptVoid(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
|
||||||
override fun visitClass(declaration: IrClass) {
|
|
||||||
val actualName = context.getLocalClassType(declaration)?.internalName
|
|
||||||
if (actualName != null) {
|
|
||||||
val expectedName = context.state.bindingTrace.get(CodegenBinding.ASM_TYPE, declaration.symbol.descriptor)?.internalName
|
|
||||||
if (expectedName != null && expectedName != actualName) {
|
|
||||||
throw AssertionError(
|
|
||||||
"Incorrect name for the class.\n" +
|
|
||||||
"IR: ${declaration.render()}\n" +
|
|
||||||
"Descriptor: ${declaration.descriptor}\n" +
|
|
||||||
"Expected name: $expectedName\n" +
|
|
||||||
"Actual name: $actualName"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.visitClass(declaration)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun visitElement(element: IrElement) {
|
|
||||||
element.acceptChildrenVoid(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-1
@@ -31,7 +31,6 @@ where advanced options include:
|
|||||||
Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment
|
Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment
|
||||||
-Xfriend-paths=<path> Paths to output directories for friend modules (whose internals should be visible)
|
-Xfriend-paths=<path> Paths to output directories for friend modules (whose internals should be visible)
|
||||||
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
|
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
|
||||||
-Xir-check-local-names Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend
|
|
||||||
-Xmodule-path=<path> Paths where to find Java 9+ modules
|
-Xmodule-path=<path> Paths where to find Java 9+ modules
|
||||||
-Xjava-package-prefix Package prefix for Java files
|
-Xjava-package-prefix Package prefix for Java files
|
||||||
-Xjava-source-roots=<path> Paths to directories with Java source files
|
-Xjava-source-roots=<path> Paths to directories with Java source files
|
||||||
|
|||||||
Reference in New Issue
Block a user