From c476171d838c55bbfe36856e73a470e826748acc Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 27 Jan 2014 15:35:12 +0100 Subject: Cache result of narrow on Methods. narrow is exercised a lot after the improvement to normalize. So it's important to cache it in order not to bust `uniques` with NoprefixTermRefs. --- src/dotty/tools/dotc/core/Uniques.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/Uniques.scala') diff --git a/src/dotty/tools/dotc/core/Uniques.scala b/src/dotty/tools/dotc/core/Uniques.scala index 765b5d73f..9ad736c9c 100644 --- a/src/dotty/tools/dotc/core/Uniques.scala +++ b/src/dotty/tools/dotc/core/Uniques.scala @@ -24,7 +24,12 @@ object Uniques { def unique[T <: Type](tp: T)(implicit ctx: Context): T = { if (monitored) recordCaching(tp) if (tp.hash == NotCached) tp - else ctx.uniques.findEntryOrUpdate(tp).asInstanceOf[T] + else if (monitored) { + val size = ctx.uniques.size + val result = ctx.uniques.findEntryOrUpdate(tp).asInstanceOf[T] + if (ctx.uniques.size > size) record(s"fresh unique ${tp.getClass}") + result + } else ctx.uniques.findEntryOrUpdate(tp).asInstanceOf[T] } /* !!! DEBUG ensuring ( result => tp.toString == result.toString || { -- cgit v1.2.3