Skip to content

Commit

Permalink
Use AnyRefMap
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym committed Feb 22, 2018
1 parent 937c0c0 commit 3e4b3b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class ExtractAPI[GlobalType <: Global](
// this cache reduces duplicate work both here and when persisting
// caches on other structures had minimal effect on time and cache size
// (tried: Definition, Modifier, Path, Id, String)
private[this] val typeCache = perRunCaches.newMap[(Symbol, Type), xsbti.api.Type]()
private[this] val typeCache = perRunCaches.newAnyRefMap[(Symbol, Type), xsbti.api.Type]()
// these caches are necessary for correctness
private[this] val structureCache = perRunCaches.newMap[Symbol, xsbti.api.Structure]()
private[this] val structureCache = perRunCaches.newAnyRefMap[Symbol, xsbti.api.Structure]()
private[this] val classLikeCache =
perRunCaches.newMap[(Symbol, Symbol), xsbti.api.ClassLikeDef]()
perRunCaches.newAnyRefMap[(Symbol, Symbol), xsbti.api.ClassLikeDef]()
private[this] val pending = perRunCaches.newSet[xsbti.api.Lazy[_]]()

private[this] val emptyStringArray = Array.empty[String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class HashAPI private (

private[this] val visitedStructures = visitedMap[Structure]
private[this] val visitedClassLike = visitedMap[ClassLike]
private[this] def visitedMap[T] = new mutable.HashMap[T, List[Hash]]
private[this] def visitedMap[T <: AnyRef] = new mutable.AnyRefMap[T, List[Hash]]
private[this] def visit[T](map: mutable.Map[T, List[Hash]], t: T)(hashF: T => Unit): Unit = {
map.put(t, hash :: map.getOrElse(t, Nil)) match {
case Some(x :: _) => extend(x)
Expand Down

0 comments on commit 3e4b3b4

Please sign in to comment.