JVM_IR: use ConcurrentHashMap

Replace mutable maps and sets accessed from by-file lowerings with
ConcurrentHashMap, so that lowerings can operate on them in parallel.
This commit is contained in:
Georgy Bronnikov
2021-01-13 16:41:09 +03:00
parent 23da2bde67
commit 4e9bedc2fc
9 changed files with 34 additions and 27 deletions
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.ir.declarations.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.reflect.KMutableProperty0
import kotlin.reflect.KProperty
@@ -47,7 +48,7 @@ open class DefaultMapping : Mapping {
override val reflectedNameAccessor: Mapping.Delegate<IrClass, IrSimpleFunction> = newMapping()
protected open fun <K : IrDeclaration, V> newMapping() = object : Mapping.Delegate<K, V>() {
private val map: MutableMap<K, V> = mutableMapOf()
private val map: MutableMap<K, V> = ConcurrentHashMap()
override operator fun get(key: K): V? {
return map[key]