diff options
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/util/LRUCache.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/util/SixteenNibbles.scala | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 377b20991..71218680a 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -327,7 +327,7 @@ object Types { } /** The member of this type with the given name */ - final def member(name: Name)(implicit ctx: Context): Denotation = /*>|>*/ track("member-" + name) /*<|<*/ { + final def member(name: Name)(implicit ctx: Context): Denotation = /*>|>*/ track("member") /*<|<*/ { findMember(name, widenIfUnstable, EmptyFlags) } diff --git a/src/dotty/tools/dotc/util/LRUCache.scala b/src/dotty/tools/dotc/util/LRUCache.scala index 5a485081f..4d0d82c99 100644 --- a/src/dotty/tools/dotc/util/LRUCache.scala +++ b/src/dotty/tools/dotc/util/LRUCache.scala @@ -1,6 +1,7 @@ package dotty.tools.dotc.util import reflect.ClassTag +import annotation.tailrec /** A least-recently-used cache for Key -> Value computations * It currently keeps the last 8 associations, but this can be @@ -29,6 +30,7 @@ class LRUCache[Key >: Null : ClassTag, Value >: Null: ClassTag] { * if key was not found. */ def lookup(key: Key): Value = { + @tailrec def lookupNext(prev: Int, current: Int, nx: SixteenNibbles): Value = { val follow = nx(current) if (keys(current) == key) { @@ -89,7 +91,7 @@ class LRUCache[Key >: Null : ClassTag, Value >: Null: ClassTag] { object LRUCache { /** The number of retained elements in the cache; must be at most 16. */ - val Retained = 8 + val Retained = 16 /** The initial ring: 0 -> 1 -> ... -> 7 -> 0 */ val initialRing = diff --git a/src/dotty/tools/dotc/util/SixteenNibbles.scala b/src/dotty/tools/dotc/util/SixteenNibbles.scala index 58d4a1182..59d1b0301 100644 --- a/src/dotty/tools/dotc/util/SixteenNibbles.scala +++ b/src/dotty/tools/dotc/util/SixteenNibbles.scala @@ -12,7 +12,7 @@ class SixteenNibbles(val bits: Long) extends AnyVal { def updated(idx: Int, value: Int): SixteenNibbles = new SixteenNibbles( - (bits & ~(Mask << (idx * Width))) | + (bits & ~(LongMask << (idx * Width))) | ((value & Mask).toLong << (idx * Width))) def elements: IndexedSeq[Int] = (0 until 16) map apply @@ -24,4 +24,5 @@ class SixteenNibbles(val bits: Long) extends AnyVal { object SixteenNibbles { final val Width = 4 final val Mask = (1 << Width) - 1 + final val LongMask = Mask.toLong }
\ No newline at end of file |