aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-18 19:30:01 +0200
committerMartin Odersky <odersky@gmail.com>2015-05-21 17:41:15 +0200
commit24a95aa44a02d438d4df179a6475edfc690f9d9a (patch)
tree574090b659fbded970429c57828e9bd545686c31 /src/dotty
parent110a438c000cd77caff28ebe9725d2a00f8060d6 (diff)
downloaddotty-24a95aa44a02d438d4df179a6475edfc690f9d9a.tar.gz
dotty-24a95aa44a02d438d4df179a6475edfc690f9d9a.tar.bz2
dotty-24a95aa44a02d438d4df179a6475edfc690f9d9a.zip
Move threshold values to Config
It's a more logical home for them than the Context object.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/config/Config.scala19
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala21
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala4
-rw-r--r--src/dotty/tools/dotc/core/Uniques.scala7
5 files changed, 29 insertions, 24 deletions
diff --git a/src/dotty/tools/dotc/config/Config.scala b/src/dotty/tools/dotc/config/Config.scala
index 38ebca078..c00b06913 100644
--- a/src/dotty/tools/dotc/config/Config.scala
+++ b/src/dotty/tools/dotc/config/Config.scala
@@ -71,4 +71,23 @@ object Config {
/** Check that certain types cannot be created in erasedTypes phases */
final val checkUnerased = true
+
+
+ /** Initial size of superId table */
+ final val InitialSuperIdsSize = 4096
+
+ /** Initial capacity of uniques HashMap */
+ final val initialUniquesCapacity = 40000
+
+ /** How many recursive calls to NamedType#underlying are performed before logging starts. */
+ final val LogPendingUnderlyingThreshold = 50
+
+ /** How many recursive calls to isSubType are performed before logging starts. */
+ final val LogPendingSubTypesThreshold = 50
+
+ /** How many recursive calls to findMember are performed before logging names starts */
+ final val LogPendingFindMemberThreshold = 20
+
+ /** Maximal number of outstanding recursive calls to findMember */
+ final val PendingFindMemberLimit = LogPendingFindMemberThreshold * 2
}
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 5d2750aa8..88923d31d 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -20,6 +20,7 @@ import util.{FreshNameCreator, SimpleMap, SourceFile, NoSource}
import typer._
import Implicits.ContextualImplicits
import config.Settings._
+import config.Config
import reporting._
import collection.mutable
import collection.immutable.BitSet
@@ -508,7 +509,7 @@ object Contexts {
def nextId = { _nextId += 1; _nextId }
/** A map from a superclass id to the typeref of the class that has it */
- private[core] var classOfId = new Array[ClassSymbol](InitialSuperIdsSize)
+ private[core] var classOfId = new Array[ClassSymbol](Config.InitialSuperIdsSize)
/** A map from a the typeref of a class to its superclass id */
private[core] val superIdOfClass = new mutable.AnyRefMap[ClassSymbol, Int]
@@ -529,7 +530,7 @@ object Contexts {
// Types state
/** A table for hash consing unique types */
- private[core] val uniques = new util.HashSet[Type](initialUniquesCapacity) {
+ private[core] val uniques = new util.HashSet[Type](Config.initialUniquesCapacity) {
override def hash(x: Type): Int = x.hash
}
@@ -614,20 +615,4 @@ object Contexts {
myBounds = myBounds.updated(sym, b)
def bounds = myBounds
}
-
- /** Initial size of superId table */
- private final val InitialSuperIdsSize = 4096
-
- /** Initial capacity of uniques HashMap */
- private[core] final val initialUniquesCapacity = 40000
-
- /** How many recursive calls to NamedType#underlying are performed before
- * logging starts.
- */
- private[core] final val LogPendingUnderlyingThreshold = 50
-
- /** How many recursive calls to isSubType are performed before
- * logging starts.
- */
- private[core] final val LogPendingSubTypesThreshold = 50
}
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 89c3958af..671e4556f 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -97,7 +97,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
try {
recCount = recCount + 1
val result =
- if (recCount < LogPendingSubTypesThreshold) firstTry(tp1, tp2)
+ if (recCount < Config.LogPendingSubTypesThreshold) firstTry(tp1, tp2)
else monitoredIsSubType(tp1, tp2)
recCount = recCount - 1
if (!result) constraint = saved
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 6e18f4a50..d5e0e3eba 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1426,7 +1426,7 @@ object Types {
def isTerm = isInstanceOf[TermRef]
/** Guard against cycles that can arise if given `op`
- * follows info. The prblematic cases are a type alias to itself or
+ * follows info. The problematic cases are a type alias to itself or
* bounded by itself or a val typed as itself:
*
* type T <: T
@@ -1437,7 +1437,7 @@ object Types {
*/
final def controlled[T](op: => T)(implicit ctx: Context): T = try {
ctx.underlyingRecursions += 1
- if (ctx.underlyingRecursions < LogPendingUnderlyingThreshold)
+ if (ctx.underlyingRecursions < Config.LogPendingUnderlyingThreshold)
op
else if (ctx.pendingUnderlying contains this)
throw CyclicReference(symbol)
diff --git a/src/dotty/tools/dotc/core/Uniques.scala b/src/dotty/tools/dotc/core/Uniques.scala
index c24b0cabc..b00508d60 100644
--- a/src/dotty/tools/dotc/core/Uniques.scala
+++ b/src/dotty/tools/dotc/core/Uniques.scala
@@ -2,6 +2,7 @@ package dotty.tools.dotc
package core
import Types._, Contexts._, util.Stats._, Hashable._, Names._
+import config.Config
import util.HashSet
/** Defines operation `unique` for hash-consing types.
@@ -39,7 +40,7 @@ object Uniques {
)
*/
- final class NamedTypeUniques extends HashSet[NamedType](initialUniquesCapacity) with Hashable {
+ final class NamedTypeUniques extends HashSet[NamedType](Config.initialUniquesCapacity) with Hashable {
override def hash(x: NamedType): Int = x.hash
private def findPrevious(h: Int, prefix: Type, name: Name): NamedType = {
@@ -65,7 +66,7 @@ object Uniques {
}
}
- final class TypeAliasUniques extends HashSet[TypeAlias](initialUniquesCapacity) with Hashable {
+ final class TypeAliasUniques extends HashSet[TypeAlias](Config.initialUniquesCapacity) with Hashable {
override def hash(x: TypeAlias): Int = x.hash
private def findPrevious(h: Int, alias: Type, variance: Int): TypeAlias = {
@@ -90,7 +91,7 @@ object Uniques {
}
}
- final class RefinedUniques extends HashSet[RefinedType](initialUniquesCapacity) with Hashable {
+ final class RefinedUniques extends HashSet[RefinedType](Config.initialUniquesCapacity) with Hashable {
override val hashSeed = classOf[CachedRefinedType].hashCode // some types start life as CachedRefinedTypes, need to have same hash seed
override def hash(x: RefinedType): Int = x.hash