[JS IR] Pass dirty files into backend and load IR for them only
This commit is contained in:
committed by
TeamCityServer
parent
43bfe2333c
commit
4bd6e8a034
@@ -54,6 +54,7 @@ fun compile(
|
|||||||
lowerPerModule: Boolean = false,
|
lowerPerModule: Boolean = false,
|
||||||
safeExternalBoolean: Boolean = false,
|
safeExternalBoolean: Boolean = false,
|
||||||
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||||
|
filesToLower: Set<String>? = null
|
||||||
): CompilerResult {
|
): CompilerResult {
|
||||||
|
|
||||||
if (lowerPerModule) {
|
if (lowerPerModule) {
|
||||||
@@ -75,7 +76,7 @@ fun compile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
|
val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
|
||||||
loadIr(depsDescriptors, irFactory, verifySignatures)
|
loadIr(depsDescriptors, irFactory, verifySignatures, filesToLower)
|
||||||
val mainModule = depsDescriptors.mainModule
|
val mainModule = depsDescriptors.mainModule
|
||||||
val configuration = depsDescriptors.compilerConfiguration
|
val configuration = depsDescriptors.compilerConfiguration
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ object EmptyLoweringsCacheProvider : LoweringsCacheProvider {
|
|||||||
fun loadIr(
|
fun loadIr(
|
||||||
depsDescriptors: ModulesStructure,
|
depsDescriptors: ModulesStructure,
|
||||||
irFactory: IrFactory,
|
irFactory: IrFactory,
|
||||||
verifySignatures: Boolean
|
verifySignatures: Boolean,
|
||||||
|
filesToLoad: Set<String>? = null
|
||||||
): IrModuleInfo {
|
): IrModuleInfo {
|
||||||
val project = depsDescriptors.project
|
val project = depsDescriptors.project
|
||||||
val mainModule = depsDescriptors.mainModule
|
val mainModule = depsDescriptors.mainModule
|
||||||
@@ -269,6 +270,7 @@ fun loadIr(
|
|||||||
|
|
||||||
when (mainModule) {
|
when (mainModule) {
|
||||||
is MainModule.SourceFiles -> {
|
is MainModule.SourceFiles -> {
|
||||||
|
assert(filesToLoad == null)
|
||||||
val (psi2IrContext, _) = preparePsi2Ir(depsDescriptors, errorPolicy, symbolTable)
|
val (psi2IrContext, _) = preparePsi2Ir(depsDescriptors, errorPolicy, symbolTable)
|
||||||
val irBuiltIns = psi2IrContext.irBuiltIns
|
val irBuiltIns = psi2IrContext.irBuiltIns
|
||||||
val feContext = psi2IrContext.run {
|
val feContext = psi2IrContext.run {
|
||||||
@@ -362,18 +364,25 @@ fun loadIr(
|
|||||||
|
|
||||||
val deserializedModuleFragments =
|
val deserializedModuleFragments =
|
||||||
sortDependencies(reachableDependencies.getFullResolvedList(), depsDescriptors.descriptors).map { klib ->
|
sortDependencies(reachableDependencies.getFullResolvedList(), depsDescriptors.descriptors).map { klib ->
|
||||||
val strategy =
|
val descriptor = depsDescriptors.getModuleDescriptor(klib)
|
||||||
if (klib == mainModuleLib)
|
if (filesToLoad != null) {
|
||||||
|
if (klib == mainModuleLib) {
|
||||||
|
irLinker.deserializeDirtyFiles(descriptor, klib, filesToLoad)
|
||||||
|
} else {
|
||||||
|
irLinker.deserializeHeadersWithInlineBodies(descriptor, klib)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val strategy = if (klib == mainModuleLib)
|
||||||
DeserializationStrategy.ALL
|
DeserializationStrategy.ALL
|
||||||
else
|
else
|
||||||
DeserializationStrategy.EXPLICITLY_EXPORTED
|
DeserializationStrategy.EXPLICITLY_EXPORTED
|
||||||
|
|
||||||
irLinker.deserializeIrModuleHeader(depsDescriptors.getModuleDescriptor(klib), klib, { strategy })
|
irLinker.deserializeIrModuleHeader(descriptor, klib, { strategy })
|
||||||
.also { moduleFragment ->
|
}.also { moduleFragment ->
|
||||||
klib.manifestProperties.getProperty(KLIB_PROPERTY_JS_OUTPUT_NAME)?.let {
|
klib.manifestProperties.getProperty(KLIB_PROPERTY_JS_OUTPUT_NAME)?.let {
|
||||||
moduleFragmentToUniqueName[moduleFragment] = it
|
moduleFragmentToUniqueName[moduleFragment] = it
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val moduleFragment = deserializedModuleFragments.last()
|
val moduleFragment = deserializedModuleFragments.last()
|
||||||
|
|||||||
Reference in New Issue
Block a user