[PL] Log partial linkage messages at different severity
As specified in -Xpartial-linkage-loglevel CLI argument.
This commit is contained in:
committed by
Space Team
parent
d738646a61
commit
1fef48bb60
@@ -14,6 +14,7 @@ import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.createPartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.lower.ExpectDeclarationRemover
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DescriptorByIdSignatureFinderImpl
|
||||
@@ -83,7 +84,7 @@ fun generateIrForKlibSerialization(
|
||||
messageLogger,
|
||||
psi2IrContext.irBuiltIns,
|
||||
psi2IrContext.symbolTable,
|
||||
partialLinkageEnabled = configuration.partialLinkageConfig.isEnabled,
|
||||
partialLinkageSupport = createPartialLinkageSupportForLinker(configuration.partialLinkageConfig, psi2IrContext.irBuiltIns, messageLogger),
|
||||
feContext,
|
||||
ICData(icData.map { it.irData }, errorPolicy.allowErrors),
|
||||
stubGenerator = stubGenerator
|
||||
|
||||
+1
-4
@@ -98,9 +98,6 @@ abstract class AbstractAddContinuationToFunctionCallsLowering : BodyLoweringPass
|
||||
context.partialLinkageSupport.throwLinkageError(
|
||||
SuspendableFunctionCallWithoutCoroutineContext(this),
|
||||
element = this,
|
||||
file,
|
||||
suppressWarningInCompilerOutput = false
|
||||
file
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ class JsIrBackendContext(
|
||||
}
|
||||
|
||||
override val partialLinkageSupport = createPartialLinkageSupportForLowerings(
|
||||
isEnabled = configuration.partialLinkageConfig.isEnabled,
|
||||
configuration.partialLinkageConfig,
|
||||
irBuiltIns,
|
||||
configuration.irMessageLogger
|
||||
)
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.ir.backend.js.ic
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.createPartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DeserializationStrategy
|
||||
import org.jetbrains.kotlin.backend.common.serialization.checkIsFunctionInterface
|
||||
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
||||
@@ -108,13 +109,13 @@ internal class JsIrLinkerLoader(
|
||||
val moduleDescriptor = loadedModules.keys.last()
|
||||
val typeTranslator = TypeTranslatorImpl(symbolTable, compilerConfiguration.languageVersionSettings, moduleDescriptor)
|
||||
val irBuiltIns = IrBuiltInsOverDescriptors(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
val partialLinkageEnabled = compilerConfiguration.partialLinkageConfig.isEnabled
|
||||
val messageLogger = compilerConfiguration.irMessageLogger
|
||||
val linker = JsIrLinker(
|
||||
currentModule = null,
|
||||
messageLogger = compilerConfiguration.irMessageLogger,
|
||||
messageLogger = messageLogger,
|
||||
builtIns = irBuiltIns,
|
||||
symbolTable = symbolTable,
|
||||
partialLinkageEnabled = partialLinkageEnabled,
|
||||
partialLinkageSupport = createPartialLinkageSupportForLinker(compilerConfiguration.partialLinkageConfig, irBuiltIns, messageLogger),
|
||||
translationPluginContext = null,
|
||||
friendModules = mapOf(mainLibrary.uniqueName to mainModuleFriends.map { it.uniqueName })
|
||||
)
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ interface PartialLinkageSupportForLowerings {
|
||||
partialLinkageCase: PartialLinkageCase,
|
||||
element: IrElement,
|
||||
file: PLFile,
|
||||
suppressWarningInCompilerOutput: Boolean
|
||||
doNotLog: Boolean = false
|
||||
): IrCall
|
||||
|
||||
companion object {
|
||||
@@ -26,7 +26,7 @@ interface PartialLinkageSupportForLowerings {
|
||||
partialLinkageCase: PartialLinkageCase,
|
||||
element: IrElement,
|
||||
file: PLFile,
|
||||
suppressWarningInCompilerOutput: Boolean
|
||||
doNotLog: Boolean
|
||||
): IrCall = error("Should not be called")
|
||||
}
|
||||
}
|
||||
|
||||
+16
-4
@@ -10,17 +10,29 @@ import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageConfig
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageLogLevel
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.allUnbound
|
||||
|
||||
fun createPartialLinkageSupportForLinker(isEnabled: Boolean, builtIns: IrBuiltIns, messageLogger: IrMessageLogger) =
|
||||
if (isEnabled) PartialLinkageSupportForLinkerImpl(builtIns, messageLogger) else PartialLinkageSupportForLinker.DISABLED
|
||||
fun createPartialLinkageSupportForLinker(
|
||||
partialLinkageConfig: PartialLinkageConfig,
|
||||
builtIns: IrBuiltIns,
|
||||
messageLogger: IrMessageLogger
|
||||
): PartialLinkageSupportForLinker = if (partialLinkageConfig.isEnabled)
|
||||
PartialLinkageSupportForLinkerImpl(builtIns, partialLinkageConfig.logLevel, messageLogger)
|
||||
else
|
||||
PartialLinkageSupportForLinker.DISABLED
|
||||
|
||||
internal class PartialLinkageSupportForLinkerImpl(builtIns: IrBuiltIns, messageLogger: IrMessageLogger) : PartialLinkageSupportForLinker {
|
||||
internal class PartialLinkageSupportForLinkerImpl(
|
||||
builtIns: IrBuiltIns,
|
||||
logLevel: PartialLinkageLogLevel,
|
||||
messageLogger: IrMessageLogger
|
||||
) : PartialLinkageSupportForLinker {
|
||||
private val stubGenerator = MissingDeclarationStubGenerator(builtIns)
|
||||
private val classifierExplorer = ClassifierExplorer(builtIns, stubGenerator)
|
||||
private val patcher = PartiallyLinkedIrTreePatcher(builtIns, classifierExplorer, stubGenerator, messageLogger)
|
||||
private val patcher = PartiallyLinkedIrTreePatcher(builtIns, classifierExplorer, stubGenerator, logLevel, messageLogger)
|
||||
|
||||
override val isEnabled get() = true
|
||||
|
||||
|
||||
+21
-10
@@ -14,31 +14,42 @@ import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageCase
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageSupportForLowerings
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartiallyLinkedDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.*
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageUtils.File as PLFile
|
||||
|
||||
fun createPartialLinkageSupportForLowerings(isEnabled: Boolean, builtIns: IrBuiltIns, messageLogger: IrMessageLogger) =
|
||||
if (isEnabled) PartialLinkageSupportForLoweringsImpl(builtIns, messageLogger) else PartialLinkageSupportForLowerings.DISABLED
|
||||
fun createPartialLinkageSupportForLowerings(
|
||||
partialLinkageConfig: PartialLinkageConfig,
|
||||
builtIns: IrBuiltIns,
|
||||
messageLogger: IrMessageLogger
|
||||
): PartialLinkageSupportForLowerings = if (partialLinkageConfig.isEnabled)
|
||||
PartialLinkageSupportForLoweringsImpl(builtIns, partialLinkageConfig.logLevel, messageLogger)
|
||||
else
|
||||
PartialLinkageSupportForLowerings.DISABLED
|
||||
|
||||
internal class PartialLinkageSupportForLoweringsImpl(
|
||||
private val builtIns: IrBuiltIns,
|
||||
logLevel: PartialLinkageLogLevel,
|
||||
private val messageLogger: IrMessageLogger
|
||||
) : PartialLinkageSupportForLowerings {
|
||||
override val isEnabled get() = true
|
||||
|
||||
private val irLoggerSeverity = when (logLevel) {
|
||||
PartialLinkageLogLevel.INFO -> IrMessageLogger.Severity.INFO
|
||||
PartialLinkageLogLevel.WARNING -> IrMessageLogger.Severity.WARNING
|
||||
PartialLinkageLogLevel.ERROR -> IrMessageLogger.Severity.ERROR
|
||||
}
|
||||
|
||||
override fun throwLinkageError(
|
||||
partialLinkageCase: PartialLinkageCase,
|
||||
element: IrElement,
|
||||
file: PLFile,
|
||||
suppressWarningInCompilerOutput: Boolean
|
||||
doNotLog: Boolean
|
||||
): IrCall {
|
||||
val errorMessage = if (suppressWarningInCompilerOutput)
|
||||
partialLinkageCase.renderLinkageError()
|
||||
val errorMessage = if (doNotLog)
|
||||
partialLinkageCase.renderLinkageError() // Just render a message.
|
||||
else
|
||||
renderAndLogLinkageError(partialLinkageCase, element, file)
|
||||
renderAndLogLinkageError(partialLinkageCase, element, file) // Render + log with the appropriate severity.
|
||||
|
||||
return IrCallImpl(
|
||||
startOffset = element.startOffset,
|
||||
@@ -57,7 +68,7 @@ internal class PartialLinkageSupportForLoweringsImpl(
|
||||
val errorMessage = partialLinkageCase.renderLinkageError()
|
||||
val locationInSourceCode = file.computeLocationForOffset(element.startOffsetOfFirstDenotableIrElement())
|
||||
|
||||
messageLogger.report(IrMessageLogger.Severity.WARNING, errorMessage, locationInSourceCode) // It's OK. We log it as a warning.
|
||||
messageLogger.report(irLoggerSeverity, errorMessage, locationInSourceCode) // It's OK. We log it as a warning.
|
||||
|
||||
return errorMessage
|
||||
}
|
||||
|
||||
+9
-15
@@ -19,11 +19,8 @@ import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyDeclarationBase
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin.PARTIAL_LINKAGE_RUNTIME_ERROR
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.ExploredClassifier
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageCase
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.*
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageCase.*
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.PartiallyLinkedDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.linkage.partial.isPartialLinkageRuntimeError
|
||||
import org.jetbrains.kotlin.ir.overrides.isEffectivelyPrivate
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl
|
||||
@@ -46,6 +43,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
private val builtIns: IrBuiltIns,
|
||||
private val classifierExplorer: ClassifierExplorer,
|
||||
private val stubGenerator: MissingDeclarationStubGenerator,
|
||||
logLevel: PartialLinkageLogLevel,
|
||||
private val messageLogger: IrMessageLogger
|
||||
) {
|
||||
// Avoid revisiting roots that already have been visited.
|
||||
@@ -58,7 +56,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
private val IrModuleFragment.shouldBeSkipped: Boolean get() = files.isEmpty() || name.asString() == stdlibModule.name
|
||||
|
||||
// Used only to generate IR expressions that throw linkage errors.
|
||||
private val supportForLowerings by lazy { PartialLinkageSupportForLoweringsImpl(builtIns, messageLogger) }
|
||||
private val supportForLowerings by lazy { PartialLinkageSupportForLoweringsImpl(builtIns, logLevel, messageLogger) }
|
||||
|
||||
fun patchModuleFragments(roots: Sequence<IrModuleFragment>) {
|
||||
roots.forEach { root ->
|
||||
@@ -183,10 +181,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
anonInitializer.body.statements.clear()
|
||||
|
||||
// Generate IR call that throws linkage error. Report compiler warning.
|
||||
anonInitializer.body.statements += partialLinkageCase.throwLinkageError(
|
||||
anonInitializer,
|
||||
suppressWarningInCompilerOutput = false
|
||||
)
|
||||
anonInitializer.body.statements += partialLinkageCase.throwLinkageError(anonInitializer)
|
||||
|
||||
// Finish processing of the current class.
|
||||
declaration.typeParameters.forEach { tp ->
|
||||
@@ -251,7 +246,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
// Note: Don't log errors for members of unlinked class.
|
||||
// - All such members are unusable anyway since their dispatch receiver (class) is unusable.
|
||||
// - Also, this reduces the number of compiler error messages and makes the compiler output less polluted.
|
||||
suppressWarningInCompilerOutput = declaration.isDirectMemberOf(unusableClassifierInSignature)
|
||||
doNotLog = declaration.isDirectMemberOf(unusableClassifierInSignature)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -286,7 +281,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
// Note: Don't log errors for members of unlinked class.
|
||||
// - All such members are unusable anyway since their dispatch receiver (class) is unusable.
|
||||
// - Also, this reduces the number of compiler error messages and makes the compiler output less polluted.
|
||||
suppressWarningInCompilerOutput = declaration.isDirectMemberOf(unusableClassifierInSignature)
|
||||
doNotLog = declaration.isDirectMemberOf(unusableClassifierInSignature)
|
||||
)
|
||||
|
||||
// Don't remove inline functions, this may harm linkage in K/N backend with enabled static caches.
|
||||
@@ -442,8 +437,8 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
}
|
||||
}
|
||||
|
||||
private fun PartialLinkageCase.throwLinkageError(declaration: IrDeclaration, suppressWarningInCompilerOutput: Boolean): IrCall =
|
||||
supportForLowerings.throwLinkageError(this, declaration, currentFile, suppressWarningInCompilerOutput)
|
||||
private fun PartialLinkageCase.throwLinkageError(declaration: IrDeclaration, doNotLog: Boolean = false): IrCall =
|
||||
supportForLowerings.throwLinkageError(this, declaration, currentFile, doNotLog)
|
||||
}
|
||||
|
||||
private inner class ExpressionTransformer(startingFile: PLFile?) : FileAwareIrElementTransformerVoid(startingFile) {
|
||||
@@ -981,8 +976,7 @@ internal class PartiallyLinkedIrTreePatcher(
|
||||
val linkageError = supportForLowerings.throwLinkageError(
|
||||
partialLinkageCase,
|
||||
element = this,
|
||||
transformer.currentFile,
|
||||
suppressWarningInCompilerOutput = false
|
||||
transformer.currentFile
|
||||
)
|
||||
|
||||
return if (directChildren.statements.isNotEmpty())
|
||||
|
||||
+1
-4
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.backend.common.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.*
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.createPartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FileLocalAwareLinker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
||||
@@ -31,7 +30,6 @@ abstract class KotlinIrLinker(
|
||||
val builtIns: IrBuiltIns,
|
||||
val symbolTable: SymbolTable,
|
||||
private val exportedDependencies: List<ModuleDescriptor>,
|
||||
partialLinkageEnabled: Boolean,
|
||||
val symbolProcessor: IrSymbolDeserializer.(IrSymbol, IdSignature) -> IrSymbol = { s, _ -> s },
|
||||
) : IrDeserializer, FileLocalAwareLinker {
|
||||
|
||||
@@ -53,8 +51,7 @@ abstract class KotlinIrLinker(
|
||||
|
||||
private lateinit var linkerExtensions: Collection<IrDeserializer.IrLinkerExtension>
|
||||
|
||||
val partialLinkageSupport: PartialLinkageSupportForLinker =
|
||||
createPartialLinkageSupportForLinker(partialLinkageEnabled, builtIns, messageLogger)
|
||||
open val partialLinkageSupport: PartialLinkageSupportForLinker get() = PartialLinkageSupportForLinker.DISABLED
|
||||
|
||||
protected open val userVisibleIrModulesSupport: UserVisibleIrModulesSupport get() = UserVisibleIrModulesSupport.DEFAULT
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContextImpl
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.createPartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker
|
||||
@@ -262,14 +263,12 @@ fun getIrModuleInfoForKlib(
|
||||
val typeTranslator = TypeTranslatorImpl(symbolTable, configuration.languageVersionSettings, moduleDescriptor)
|
||||
val irBuiltIns = IrBuiltInsOverDescriptors(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
|
||||
val partialLinkageEnabled = configuration.partialLinkageConfig.isEnabled
|
||||
|
||||
val irLinker = JsIrLinker(
|
||||
currentModule = null,
|
||||
messageLogger = messageLogger,
|
||||
builtIns = irBuiltIns,
|
||||
symbolTable = symbolTable,
|
||||
partialLinkageEnabled = partialLinkageEnabled,
|
||||
partialLinkageSupport = createPartialLinkageSupportForLinker(configuration.partialLinkageConfig, irBuiltIns, messageLogger),
|
||||
translationPluginContext = null,
|
||||
icData = null,
|
||||
friendModules = friendModules
|
||||
@@ -322,14 +321,12 @@ fun getIrModuleInfoForSourceFiles(
|
||||
JsIrLinker.JsFePluginContext(moduleDescriptor, symbolTable, typeTranslator, irBuiltIns)
|
||||
}
|
||||
|
||||
val partialLinkageEnabled = configuration.partialLinkageConfig.isEnabled
|
||||
|
||||
val irLinker = JsIrLinker(
|
||||
currentModule = psi2IrContext.moduleDescriptor,
|
||||
messageLogger = messageLogger,
|
||||
builtIns = irBuiltIns,
|
||||
symbolTable = symbolTable,
|
||||
partialLinkageEnabled = partialLinkageEnabled,
|
||||
partialLinkageSupport = createPartialLinkageSupportForLinker(configuration.partialLinkageConfig, irBuiltIns, messageLogger),
|
||||
translationPluginContext = feContext,
|
||||
icData = null,
|
||||
friendModules = friendModules,
|
||||
|
||||
+2
-2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
@@ -20,7 +21,7 @@ import org.jetbrains.kotlin.library.containsErrorCode
|
||||
|
||||
class JsIrLinker(
|
||||
private val currentModule: ModuleDescriptor?, messageLogger: IrMessageLogger, builtIns: IrBuiltIns, symbolTable: SymbolTable,
|
||||
partialLinkageEnabled: Boolean,
|
||||
override val partialLinkageSupport: PartialLinkageSupportForLinker,
|
||||
override val translationPluginContext: TranslationPluginContext?,
|
||||
private val icData: ICData? = null,
|
||||
friendModules: Map<String, Collection<String>> = emptyMap(),
|
||||
@@ -31,7 +32,6 @@ class JsIrLinker(
|
||||
builtIns = builtIns,
|
||||
symbolTable = symbolTable,
|
||||
exportedDependencies = emptyList(),
|
||||
partialLinkageEnabled = partialLinkageEnabled,
|
||||
symbolProcessor = { symbol, idSig ->
|
||||
if (idSig.isLocal) {
|
||||
symbol.privateSignature = IdSignature.CompositeSignature(IdSignature.FileSignature(fileSymbol), idSig)
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.backend.jvm.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData
|
||||
@@ -41,7 +42,7 @@ class JvmIrLinker(
|
||||
private val stubGenerator: DeclarationStubGenerator,
|
||||
private val manglerDesc: JvmDescriptorMangler,
|
||||
private val enableIdSignatures: Boolean,
|
||||
) : KotlinIrLinker(currentModule, messageLogger, typeSystem.irBuiltIns, symbolTable, emptyList(), partialLinkageEnabled = false) {
|
||||
) : KotlinIrLinker(currentModule, messageLogger, typeSystem.irBuiltIns, symbolTable, emptyList()) {
|
||||
|
||||
override val fakeOverrideBuilder = FakeOverrideBuilder(
|
||||
linker = this,
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiElement
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.backend.common.CommonJsKLibResolver
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DeserializationStrategy
|
||||
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataIncrementalSerializer
|
||||
@@ -224,7 +225,7 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
|
||||
val typeTranslator =
|
||||
TypeTranslatorImpl(symbolTable, myEnvironment.configuration.languageVersionSettings, testDescriptor)
|
||||
val irBuiltIns = IrBuiltInsOverDescriptors(testDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
val irLinker = JsIrLinker(null, IrMessageLogger.None, irBuiltIns, symbolTable, partialLinkageEnabled = false, null)
|
||||
val irLinker = JsIrLinker(null, IrMessageLogger.None, irBuiltIns, symbolTable, PartialLinkageSupportForLinker.DISABLED, null)
|
||||
irLinker.deserializeIrModuleHeader(stdlibDescriptor, stdlib)
|
||||
val testModule = irLinker.deserializeIrModuleHeader(testDescriptor, klib, { DeserializationStrategy.ALL })
|
||||
irLinker.init(null, emptyList())
|
||||
@@ -290,7 +291,7 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
|
||||
val symbolTable = SymbolTable(IdSignatureDescriptor(JsManglerDesc), IrFactoryImpl, NameProvider.DEFAULT)
|
||||
val context = psi2Ir.createGeneratorContext(moduleDescriptor, bindingContext, symbolTable)
|
||||
val irBuiltIns = context.irBuiltIns
|
||||
val irLinker = JsIrLinker(moduleDescriptor, messageLogger, irBuiltIns, symbolTable, partialLinkageEnabled = false, null)
|
||||
val irLinker = JsIrLinker(moduleDescriptor, messageLogger, irBuiltIns, symbolTable, PartialLinkageSupportForLinker.DISABLED, null)
|
||||
irLinker.deserializeIrModuleHeader(stdlibDescriptor, stdlib)
|
||||
|
||||
return psi2Ir.generateModuleFragment(context, ktFiles, listOf(irLinker), emptyList(), expectActualSymbols) to bindingContext
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.KtPsiSourceFile
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
import org.jetbrains.kotlin.backend.common.phaser.invokeToplevel
|
||||
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
||||
@@ -472,7 +473,7 @@ class GenerateIrRuntime {
|
||||
messageLogger,
|
||||
psi2IrContext.irBuiltIns,
|
||||
psi2IrContext.symbolTable,
|
||||
partialLinkageEnabled = false,
|
||||
PartialLinkageSupportForLinker.DISABLED,
|
||||
null
|
||||
)
|
||||
|
||||
@@ -550,7 +551,7 @@ class GenerateIrRuntime {
|
||||
val typeTranslator = TypeTranslatorImpl(symbolTable, languageVersionSettings, moduleDescriptor)
|
||||
val irBuiltIns = IrBuiltInsOverDescriptors(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
|
||||
val jsLinker = JsIrLinker(moduleDescriptor, IrMessageLogger.None, irBuiltIns, symbolTable, partialLinkageEnabled = false, null)
|
||||
val jsLinker = JsIrLinker(moduleDescriptor, IrMessageLogger.None, irBuiltIns, symbolTable, PartialLinkageSupportForLinker.DISABLED, null)
|
||||
|
||||
val moduleFragment = jsLinker.deserializeFullModule(moduleDescriptor, moduleDescriptor.kotlinLibrary)
|
||||
jsLinker.init(null, emptyList())
|
||||
@@ -575,7 +576,7 @@ class GenerateIrRuntime {
|
||||
val typeTranslator = TypeTranslatorImpl(symbolTable, languageVersionSettings, moduleDescriptor)
|
||||
val irBuiltIns = IrBuiltInsOverDescriptors(moduleDescriptor.builtIns, typeTranslator, symbolTable)
|
||||
|
||||
val jsLinker = JsIrLinker(moduleDescriptor, IrMessageLogger.None, irBuiltIns, symbolTable, partialLinkageEnabled = false, null)
|
||||
val jsLinker = JsIrLinker(moduleDescriptor, IrMessageLogger.None, irBuiltIns, symbolTable, PartialLinkageSupportForLinker.DISABLED, null)
|
||||
|
||||
val moduleFragment = jsLinker.deserializeFullModule(moduleDescriptor, moduleDescriptor.kotlinLibrary)
|
||||
// Create stubs
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ internal class Context(
|
||||
override fun dispose() {}
|
||||
|
||||
override val partialLinkageSupport = createPartialLinkageSupportForLowerings(
|
||||
config.partialLinkageConfig.isEnabled,
|
||||
config.partialLinkageConfig,
|
||||
irBuiltIns,
|
||||
configuration.irMessageLogger
|
||||
)
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ package org.jetbrains.kotlin.backend.konan
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContextImpl
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.createPartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.DescriptorByIdSignatureFinderImpl
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker
|
||||
@@ -54,11 +55,11 @@ internal fun PsiToIrContext.psiToIr(
|
||||
val expectActualLinker = config.configuration[CommonConfigurationKeys.EXPECT_ACTUAL_LINKER] ?: false
|
||||
val messageLogger = config.configuration.irMessageLogger
|
||||
|
||||
val partialLinkageEnabled = config.configuration.partialLinkageConfig.isEnabled
|
||||
val partialLinkageConfig = config.configuration.partialLinkageConfig
|
||||
|
||||
val translator = Psi2IrTranslator(
|
||||
config.configuration.languageVersionSettings,
|
||||
Psi2IrConfiguration(ignoreErrors = false, partialLinkageEnabled),
|
||||
Psi2IrConfiguration(ignoreErrors = false, partialLinkageConfig.isEnabled),
|
||||
messageLogger::checkNoUnboundSymbols
|
||||
)
|
||||
val generatorContext = translator.createGeneratorContext(moduleDescriptor, bindingContext, symbolTable)
|
||||
@@ -142,7 +143,7 @@ internal fun PsiToIrContext.psiToIr(
|
||||
stubGenerator = stubGenerator,
|
||||
cenumsProvider = irProviderForCEnumsAndCStructs,
|
||||
exportedDependencies = exportedDependencies,
|
||||
partialLinkageEnabled = partialLinkageEnabled,
|
||||
partialLinkageSupport = createPartialLinkageSupportForLinker(partialLinkageConfig, generatorContext.irBuiltIns, messageLogger),
|
||||
cachedLibraries = config.cachedLibraries,
|
||||
lazyIrForCaches = config.lazyIrForCaches,
|
||||
libraryBeingCached = config.libraryToCache,
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.backend.konan.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.UserVisibleIrModulesSupport
|
||||
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinker
|
||||
import org.jetbrains.kotlin.backend.common.lower.parents
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder
|
||||
import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideClassFilter
|
||||
@@ -349,12 +350,12 @@ internal class KonanIrLinker(
|
||||
private val stubGenerator: DeclarationStubGenerator,
|
||||
private val cenumsProvider: IrProviderForCEnumAndCStructStubs,
|
||||
exportedDependencies: List<ModuleDescriptor>,
|
||||
partialLinkageEnabled: Boolean,
|
||||
override val partialLinkageSupport: PartialLinkageSupportForLinker,
|
||||
private val cachedLibraries: CachedLibraries,
|
||||
private val lazyIrForCaches: Boolean,
|
||||
private val libraryBeingCached: PartialCacheInfo?,
|
||||
override val userVisibleIrModulesSupport: UserVisibleIrModulesSupport
|
||||
) : KotlinIrLinker(currentModule, messageLogger, builtIns, symbolTable, exportedDependencies, partialLinkageEnabled) {
|
||||
) : KotlinIrLinker(currentModule, messageLogger, builtIns, symbolTable, exportedDependencies) {
|
||||
|
||||
companion object {
|
||||
private val C_NAMES_NAME = Name.identifier("cnames")
|
||||
|
||||
Reference in New Issue
Block a user