diff options
author | Paul Phillips <paulp@improving.org> | 2012-08-03 15:28:17 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-08-04 08:05:20 -0700 |
commit | c533bf30a4637499cd5344434445e4615615b6b1 (patch) | |
tree | b42837a11ad762e292e91549422897338ce64a3d | |
parent | ab63cca87f68d80aff0ff6cd83ecd85b9e1d0c7a (diff) | |
download | scala-c533bf30a4637499cd5344434445e4615615b6b1.tar.gz scala-c533bf30a4637499cd5344434445e4615615b6b1.tar.bz2 scala-c533bf30a4637499cd5344434445e4615615b6b1.zip |
Clear uniques via perRunCaches.
That lets this huge cache be cleared eagerly after a run
is over rather than lazily when another run begins. This
arrives pre-LGTMed by Important People.
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 1 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/util/HashSet.scala | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 442a91774d..386d2896be 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -3822,6 +3822,7 @@ trait Types extends api.Types { self: SymbolTable => Statistics.incCounter(rawTypeCount) if (uniqueRunId != currentRunId) { uniques = util.HashSet[Type]("uniques", initialUniquesCapacity) + perRunCaches.recordCache(uniques) uniqueRunId = currentRunId } (uniques findEntryOrUpdate tp).asInstanceOf[T] diff --git a/src/reflect/scala/reflect/internal/util/HashSet.scala b/src/reflect/scala/reflect/internal/util/HashSet.scala index a771dad2b0..cd1fe2e9f3 100644 --- a/src/reflect/scala/reflect/internal/util/HashSet.scala +++ b/src/reflect/scala/reflect/internal/util/HashSet.scala @@ -13,7 +13,7 @@ object HashSet { new HashSet[T](label, initialCapacity) } -class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) extends Set[T] { +class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) extends Set[T] with collection.generic.Clearable { private var used = 0 private var table = new Array[AnyRef](initialCapacity) private def index(x: Int): Int = math.abs(x % table.length) |