[IR] Extract descriptor part from SymbolTable into separate component
After this change SymbolTable (and ReferenceSymbolTable) contains only methods with IdSignatures. All descriptors-related methods are moved into DescriptorSymbolTableExtension, which automatically delegates to the SymbolTable if needed At this moment there are cross-references between SymbolTable, because descriptor API is still actively used across backends. So SymbolTable is accessible in some place then descriptor extension will be accessible too DescriptorSymbolTableExtension is an implementation of abstract SymbolTableExtension which allows to implement different kinds of storages, e.g. FIR based (it probably will be needed for FIR2IR)
This commit is contained in:
committed by
Space Team
parent
0067eb85da
commit
4986cb14aa
+2
-3
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.allUnbound
|
||||
import org.jetbrains.kotlin.ir.util.irMessageLogger
|
||||
|
||||
// N.B. Checks for absence of unbound symbols only when unbound symbols are not allowed.
|
||||
@@ -18,14 +17,14 @@ fun KotlinIrLinker.checkNoUnboundSymbols(symbolTable: SymbolTable, whenDetected:
|
||||
|
||||
// N.B. Always checks for absence of unbound symbols. The condition whether this check should be applied is controlled outside.
|
||||
fun IrMessageLogger.checkNoUnboundSymbols(symbolTable: SymbolTable, whenDetected: String) {
|
||||
val unboundSymbols = symbolTable.allUnbound
|
||||
val unboundSymbols = symbolTable.descriptorExtension.allUnboundSymbols
|
||||
if (unboundSymbols.isNotEmpty())
|
||||
UnexpectedUnboundIrSymbols(unboundSymbols, whenDetected).raiseIssue(this)
|
||||
}
|
||||
|
||||
// N.B. Always checks for absence of unbound symbols. The condition whether this check should be applied is controlled outside.
|
||||
fun CompilerConfiguration.checkNoUnboundSymbols(symbolTable: SymbolTable, whenDetected: String) {
|
||||
val unboundSymbols = symbolTable.allUnbound
|
||||
val unboundSymbols = symbolTable.descriptorExtension.allUnboundSymbols
|
||||
if (unboundSymbols.isNotEmpty())
|
||||
UnexpectedUnboundIrSymbols(unboundSymbols, whenDetected).raiseIssue(irMessageLogger)
|
||||
}
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.linkage.partial.PartialLinkageLogger
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.allUnbound
|
||||
|
||||
fun createPartialLinkageSupportForLinker(
|
||||
partialLinkageConfig: PartialLinkageConfig,
|
||||
@@ -73,7 +72,7 @@ internal class PartialLinkageSupportForLinkerImpl(
|
||||
|
||||
private fun generateStubsAndPatchUsagesInternal(symbolTable: SymbolTable, patchIrTree: () -> Unit) {
|
||||
// Generate stubs.
|
||||
for (symbol in symbolTable.allUnbound) {
|
||||
for (symbol in symbolTable.descriptorExtension.allUnboundSymbols) {
|
||||
stubGenerator.getDeclaration(symbol)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -145,7 +145,7 @@ class CurrentModuleWithICDeserializer(
|
||||
|
||||
override fun init(delegate: IrModuleDeserializer) {
|
||||
val knownBuiltIns = irBuiltIns.knownBuiltins.map { (it as IrSymbolOwner).symbol }.toSet()
|
||||
symbolTable.forEachDeclarationSymbol {
|
||||
symbolTable.descriptorExtension.forEachDeclarationSymbol {
|
||||
assert(it.isPublicApi)
|
||||
if (it.descriptor.isDirtyDescriptor()) { // public && non-deserialized should be dirty symbol
|
||||
if (it !in knownBuiltIns) {
|
||||
@@ -172,4 +172,4 @@ class CurrentModuleWithICDeserializer(
|
||||
override fun fileDeserializers(): Collection<IrFileDeserializer> {
|
||||
return delegate.fileDeserializers()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user