Remove old IC: remove flags from CompilationResult

This commit is contained in:
Alexey Tsvetkov
2017-04-26 13:45:17 +03:00
parent 840f688bbf
commit 50091bfac8
2 changed files with 10 additions and 70 deletions
@@ -193,7 +193,7 @@ open class IncrementalCacheImpl<Target>(
// As a workaround we can remove proto values for multifile facades.
val additionalChangeInfo = if (className in protoMap) {
val info = ChangeInfo.SignatureChanged(className.fqNameForClassNameWithoutDollars, areSubclassesAffected = true)
CompilationResult(protoChanged = true, changes = sequenceOf(info))
CompilationResult(changes = sequenceOf(info))
}
else CompilationResult.NO_CHANGES
protoMap.remove(className)
@@ -295,12 +295,7 @@ open class IncrementalCacheImpl<Target>(
else
emptySequence<ChangeInfo>()
val changesInfo = dirtyClasses.fold(CompilationResult(changes = changes)) { info, className ->
val newInfo = CompilationResult(protoChanged = className in protoMap,
constantsChanged = className in constantsMap)
newInfo.logIfSomethingChanged(className)
info + newInfo
}
val changesInfo = CompilationResult(changes = changes)
val facadesWithRemovedParts = hashMapOf<JvmClassName, MutableSet<String>>()
for (dirtyClass in dirtyClasses) {
@@ -398,7 +393,7 @@ open class IncrementalCacheImpl<Target>(
// (also that would fail with exception).
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray): CompilationResult {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
return CompilationResult(protoChanged = true)
return CompilationResult()
}
private fun put(
@@ -426,7 +421,7 @@ open class IncrementalCacheImpl<Target>(
else
emptySequence<ChangeInfo>()
return CompilationResult(protoChanged = true, changes = changes)
return CompilationResult(changes = changes)
}
val difference = difference(oldData, data)
@@ -441,7 +436,7 @@ open class IncrementalCacheImpl<Target>(
changeList.add(ChangeInfo.MembersChanged(fqName, difference.changedMembersNames))
}
return CompilationResult(protoChanged = changeList.isNotEmpty(), changes = changeList.asSequence())
return CompilationResult(changes = changeList.asSequence())
}
operator fun contains(className: JvmClassName): Boolean =
@@ -512,7 +507,7 @@ open class IncrementalCacheImpl<Target>(
sequenceOf(ChangeInfo.MembersChanged(fqName, changedNames))
}
return CompilationResult(constantsChanged = true, changes = changes)
return CompilationResult(changes = changes)
}
fun remove(className: JvmClassName) {
@@ -753,9 +748,7 @@ open class IncrementalCacheImpl<Target>(
}
processChangedInlineFunctions(className, changed)
return CompilationResult(inlineChanged = changed.isNotEmpty(),
inlineAdded = added.isNotEmpty(),
changes = changes)
return CompilationResult(changes = changes)
}
fun remove(className: JvmClassName) {
@@ -793,10 +786,6 @@ sealed class ChangeInfo(val fqName: FqName) {
}
data class CompilationResult(
val protoChanged: Boolean = false,
val constantsChanged: Boolean = false,
val inlineChanged: Boolean = false,
val inlineAdded: Boolean = false,
val changes: Sequence<ChangeInfo> = emptySequence()
) {
companion object {
@@ -804,11 +793,7 @@ data class CompilationResult(
}
operator fun plus(other: CompilationResult): CompilationResult =
CompilationResult(protoChanged || other.protoChanged,
constantsChanged || other.constantsChanged,
inlineChanged || other.inlineChanged,
inlineAdded || other.inlineAdded,
changes + other.changes)
CompilationResult(changes + other.changes)
}
fun ByteArray.md5(): Long {
@@ -309,7 +309,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
return OK
}
processChanges(filesToCompile.values().toSet(), allCompiledFiles, dataManager, incrementalCaches.values, changesInfo, fsOperations)
changesInfo.processChangesUsingLookups(filesToCompile.values().toSet(), dataManager, fsOperations, incrementalCaches.values)
incrementalCaches.values.forEach { it.cleanDirtyInlineFunctions() }
return OK
@@ -814,51 +814,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
}
}
private fun processChanges(
compiledFiles: Set<File>,
allCompiledFiles: MutableSet<File>,
dataManager: BuildDataManager,
caches: Collection<JpsIncrementalCacheImpl>,
compilationResult: CompilationResult,
fsOperations: FSOperationsHelper
) {
if (IncrementalCompilation.isExperimental()) {
compilationResult.doProcessChangesUsingLookups(compiledFiles, dataManager, fsOperations, caches)
}
else {
compilationResult.doProcessChanges(compiledFiles, allCompiledFiles, caches, fsOperations)
}
}
private fun CompilationResult.doProcessChanges(
compiledFiles: Set<File>,
allCompiledFiles: MutableSet<File>,
caches: Collection<JpsIncrementalCacheImpl>,
fsOperations: FSOperationsHelper
) {
KotlinBuilder.LOG.debug("compilationResult = $this")
when {
inlineAdded -> {
allCompiledFiles.clear()
fsOperations.markChunk(recursively = true, kotlinOnly = true, excludeFiles = compiledFiles)
return
}
constantsChanged -> {
fsOperations.markChunk(recursively = true, kotlinOnly = false, excludeFiles = allCompiledFiles)
return
}
protoChanged -> {
fsOperations.markChunk(recursively = false, kotlinOnly = true, excludeFiles = allCompiledFiles)
}
}
if (inlineChanged) {
val files = caches.flatMap { it.getFilesToReinline() }
fsOperations.markFiles(files, excludeFiles = compiledFiles)
}
}
private class JpsICReporter : ICReporter {
override fun report(message: ()->String) {
if (KotlinBuilder.LOG.isDebugEnabled) {
@@ -867,7 +822,7 @@ private class JpsICReporter : ICReporter {
}
}
private fun CompilationResult.doProcessChangesUsingLookups(
private fun CompilationResult.processChangesUsingLookups(
compiledFiles: Set<File>,
dataManager: BuildDataManager,
fsOperations: FSOperationsHelper,