Skip to content

Commit b2c87cd

Browse files
authored
Merge pull request #6183 from rorygraves/mike/2.12_x-Backend-CHM
use java concurrent hash map for speed in GenBCode
2 parents 798c1f9 + 91f6ba8 commit b2c87cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package scala.tools.nsc
77
package backend.jvm
88

9-
import scala.collection.concurrent.TrieMap
109
import scala.collection.{concurrent, mutable}
1110
import scala.tools.asm
1211
import scala.tools.asm.Opcodes
@@ -41,8 +40,8 @@ abstract class BTypes {
4140

4241
// Concurrent maps because stack map frames are computed when in the class writer, which
4342
// might run on multiple classes concurrently.
44-
val classBTypeCacheFromSymbol: concurrent.Map[InternalName, ClassBType] = recordPerRunCache(TrieMap.empty)
45-
val classBTypeCacheFromClassfile: concurrent.Map[InternalName, ClassBType] = recordPerRunCache(TrieMap.empty)
43+
val classBTypeCacheFromSymbol: concurrent.Map[InternalName, ClassBType] = recordPerRunCache(FlatConcurrentHashMap.empty)
44+
val classBTypeCacheFromClassfile: concurrent.Map[InternalName, ClassBType] = recordPerRunCache(FlatConcurrentHashMap.empty)
4645

4746
/**
4847
* A BType is either a primitive type, a ClassBType, an ArrayBType of one of these, or a MethodType
@@ -1030,3 +1029,8 @@ object BTypes {
10301029
// when inlining, local variable names of the callee are prefixed with the name of the callee method
10311030
val InlinedLocalVariablePrefixMaxLenght = 128
10321031
}
1032+
object FlatConcurrentHashMap {
1033+
import collection.JavaConverters._
1034+
def empty[K,V]: concurrent.Map[K,V] =
1035+
new java.util.concurrent.ConcurrentHashMap[K,V].asScala
1036+
}

0 commit comments

Comments
 (0)