[IR] Remove unused Ir.irModule property
It is required for the Native backend refactoring where `Context` does not contain a reference for any particular IrModuleFragment.
This commit is contained in:
committed by
Space Team
parent
3355f04fa1
commit
c22285f824
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
// This is what Context collects about IR.
|
||||
abstract class Ir<out T : CommonBackendContext>(val context: T, val irModule: IrModuleFragment) {
|
||||
abstract class Ir<out T : CommonBackendContext>(val context: T) {
|
||||
|
||||
abstract val symbols: Symbols
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ class JsIrBackendContext(
|
||||
val module: ModuleDescriptor,
|
||||
override val irBuiltIns: IrBuiltIns,
|
||||
val symbolTable: SymbolTable,
|
||||
irModuleFragment: IrModuleFragment,
|
||||
val additionalExportedDeclarationNames: Set<FqName>,
|
||||
keep: Set<String>,
|
||||
override val configuration: CompilerConfiguration, // TODO: remove configuration from backend context
|
||||
@@ -193,7 +192,7 @@ class JsIrBackendContext(
|
||||
.find { it.valueParameters.firstOrNull()?.type?.isFunctionType == true }
|
||||
.let { symbolTable.referenceSimpleFunction(it!!) }
|
||||
|
||||
override val ir = object : Ir<JsIrBackendContext>(this, irModuleFragment) {
|
||||
override val ir = object : Ir<JsIrBackendContext>(this) {
|
||||
override val symbols = object : Symbols(irBuiltIns, symbolTable) {
|
||||
private val context = this@JsIrBackendContext
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ fun compileIr(
|
||||
moduleDescriptor,
|
||||
irBuiltIns,
|
||||
symbolTable,
|
||||
allModules.first(),
|
||||
exportedDeclarations,
|
||||
keep,
|
||||
configuration,
|
||||
|
||||
@@ -39,7 +39,6 @@ class JsIrCompilerWithIC(
|
||||
mainModule.descriptor,
|
||||
irBuiltIns,
|
||||
symbolTable,
|
||||
mainModule,
|
||||
exportedDeclarations,
|
||||
keep = emptySet(),
|
||||
configuration = configuration,
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ open class JvmIrCodegenFactory(
|
||||
val phases = if (evaluatorFragmentInfoForPsi2Ir != null) jvmFragmentLoweringPhases else jvmLoweringPhases
|
||||
val phaseConfig = customPhaseConfig ?: PhaseConfig(phases)
|
||||
val context = JvmBackendContext(
|
||||
state, irModuleFragment.irBuiltins, irModuleFragment, symbolTable, phaseConfig, extensions, backendExtension, irSerializer,
|
||||
state, irModuleFragment.irBuiltins, symbolTable, phaseConfig, extensions, backendExtension, irSerializer,
|
||||
)
|
||||
if (evaluatorFragmentInfoForPsi2Ir != null) {
|
||||
context.localDeclarationsLoweringData = mutableMapOf()
|
||||
|
||||
@@ -43,7 +43,6 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
class JvmBackendContext(
|
||||
val state: GenerationState,
|
||||
override val irBuiltIns: IrBuiltIns,
|
||||
irModuleFragment: IrModuleFragment,
|
||||
val symbolTable: SymbolTable,
|
||||
val phaseConfig: PhaseConfig,
|
||||
val generatorExtensions: JvmGeneratorExtensions,
|
||||
@@ -85,7 +84,7 @@ class JvmBackendContext(
|
||||
|
||||
val ktDiagnosticReporter = KtDiagnosticReporterWithImplicitIrBasedContext(state.diagnosticReporter, state.languageVersionSettings)
|
||||
|
||||
override val ir = JvmIr(irModuleFragment, this.symbolTable)
|
||||
override val ir = JvmIr(this.symbolTable)
|
||||
|
||||
override val sharedVariablesManager = JvmSharedVariablesManager(state.module, ir.symbols, irBuiltIns, irFactory)
|
||||
|
||||
@@ -270,9 +269,8 @@ class JvmBackendContext(
|
||||
get() = false
|
||||
|
||||
inner class JvmIr(
|
||||
irModuleFragment: IrModuleFragment,
|
||||
symbolTable: SymbolTable
|
||||
) : Ir<JvmBackendContext>(this, irModuleFragment) {
|
||||
) : Ir<JvmBackendContext>(this) {
|
||||
override val symbols = JvmSymbols(this@JvmBackendContext, symbolTable)
|
||||
|
||||
override fun unfoldInlineClassType(irType: IrType): IrType? {
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ class WasmBackendContext(
|
||||
override val propertyLazyInitialization: PropertyLazyInitialization =
|
||||
PropertyLazyInitialization(enabled = propertyLazyInitialization, eagerInitialization = wasmSymbols.eagerInitialization)
|
||||
|
||||
override val ir = object : Ir<WasmBackendContext>(this, irModuleFragment) {
|
||||
override val ir = object : Ir<WasmBackendContext>(this) {
|
||||
override val symbols: Symbols = wasmSymbols
|
||||
override fun shouldGenerateHandlerParameterForDefaultBodyFun() = true
|
||||
}
|
||||
|
||||
@@ -601,7 +601,6 @@ class GenerateIrRuntime {
|
||||
module.descriptor,
|
||||
irBuiltIns,
|
||||
symbolTable,
|
||||
module,
|
||||
additionalExportedDeclarationNames = emptySet(),
|
||||
keep = emptySet(),
|
||||
configuration
|
||||
|
||||
+2
-4
@@ -40,8 +40,6 @@ import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.konan.library.KonanLibraryLayout
|
||||
import org.jetbrains.kotlin.konan.target.Architecture
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.library.SerializedIrModule
|
||||
import org.jetbrains.kotlin.library.SerializedMetadata
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -83,7 +81,7 @@ internal class Context(
|
||||
irModules = psiToIrOutput.irModules
|
||||
irModule = psiToIrOutput.irModule
|
||||
expectDescriptorToSymbol = psiToIrOutput.expectDescriptorToSymbol
|
||||
ir = KonanIr(this, psiToIrOutput.irModule)
|
||||
ir = KonanIr(this)
|
||||
ir.symbols = psiToIrOutput.symbols
|
||||
if (psiToIrOutput.irLinker is KonanIrLinker) {
|
||||
irLinker = psiToIrOutput.irLinker
|
||||
@@ -158,7 +156,7 @@ internal class Context(
|
||||
throw Error("Another IrModule in the context.")
|
||||
}
|
||||
field = module!!
|
||||
ir = KonanIr(this, module)
|
||||
ir = KonanIr(this)
|
||||
}
|
||||
|
||||
override lateinit var ir: KonanIr
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ object KonanNameConventions {
|
||||
}
|
||||
|
||||
// This is what Context collects about IR.
|
||||
internal class KonanIr(context: Context, irModule: IrModuleFragment): Ir<Context>(context, irModule) {
|
||||
internal class KonanIr(context: Context): Ir<Context>(context) {
|
||||
override var symbols: KonanSymbols by Delegates.notNull()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user