[JS IR] Minor style fixes in JS IR IC infra

This commit is contained in:
Alexander Korepanov
2023-05-08 16:39:22 +02:00
committed by Space Team
parent 23f87eda1f
commit bb72a8bcb7
2 changed files with 9 additions and 5 deletions
@@ -478,11 +478,11 @@ class CacheUpdater(
}
fun collectFilesToRebuildSignatures(
filesWithModifiedExports: KotlinSourceFileMap<UpdatedDependenciesMetadata>
filesWithModifiedExportsOrImports: KotlinSourceFileMap<UpdatedDependenciesMetadata>
): KotlinSourceFileMap<KotlinSourceFileExports> {
val libFilesToRebuild = KotlinSourceFileMutableMap<KotlinSourceFileExports>()
for ((libFile, srcFiles) in filesWithModifiedExports) {
for ((libFile, srcFiles) in filesWithModifiedExportsOrImports) {
val filesToRebuild by lazy(LazyThreadSafetyMode.NONE) { libFilesToRebuild.getOrPutFiles(libFile) }
val fileStats by lazy(LazyThreadSafetyMode.NONE) { dirtyFileStats.getOrPutFiles(libFile) }
val cache = getLibIncrementalCache(libFile)
@@ -697,7 +697,9 @@ class CacheUpdater(
// Load declarations referenced during `context` initialization
loadedIr.loadUnboundSymbols()
val dirtyFiles = dirtyFileExports.entries.associateTo(newHashMapWithExpectedSize(dirtyFileExports.size)) { it.key to HashSet(it.value.keys) }
val dirtyFiles = dirtyFileExports.entries.associateTo(newHashMapWithExpectedSize(dirtyFileExports.size)) {
it.key to HashSet(it.value.keys)
}
stopwatch.startNext("Processing IR - updating intrinsics and builtins dependencies")
updater.updateStdlibIntrinsicDependencies(loadedIr, mainModuleFragment, dirtyFiles)
@@ -8,6 +8,8 @@ package org.jetbrains.kotlin.ir.backend.js.ic
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.protobuf.CodedInputStream
import org.jetbrains.kotlin.protobuf.CodedOutputStream
import org.jetbrains.kotlin.utils.newHashMapWithExpectedSize
import org.jetbrains.kotlin.utils.newHashSetWithExpectedSize
import java.io.File
import java.io.OutputStream
@@ -41,11 +43,11 @@ internal fun notFoundIcError(what: String, libFile: KotlinLibraryFile? = null, s
}
internal inline fun <E> buildSetUntil(to: Int, builderAction: MutableSet<E>.(Int) -> Unit): Set<E> {
return HashSet<E>(to).apply { repeat(to) { builderAction(it) } }
return newHashSetWithExpectedSize<E>(to).apply { repeat(to) { builderAction(it) } }
}
internal inline fun <K, V> buildMapUntil(to: Int, builderAction: MutableMap<K, V>.(Int) -> Unit): Map<K, V> {
return HashMap<K, V>(to).apply { repeat(to) { builderAction(it) } }
return newHashMapWithExpectedSize<K, V>(to).apply { repeat(to) { builderAction(it) } }
}
internal fun findStdlib(