aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/config/Config.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-20 12:11:14 +0200
committerMartin Odersky <odersky@gmail.com>2015-05-21 17:41:16 +0200
commit78640ebad658ddd38e86a9d98c6bbcdd83708397 (patch)
tree9c5a71e27b902322ae1bbf68784b1136fac1ebab /src/dotty/tools/dotc/config/Config.scala
parent10bb6a0e5efa8cc76f7bd6215ca3d2a44070850a (diff)
downloaddotty-78640ebad658ddd38e86a9d98c6bbcdd83708397.tar.gz
dotty-78640ebad658ddd38e86a9d98c6bbcdd83708397.tar.bz2
dotty-78640ebad658ddd38e86a9d98c6bbcdd83708397.zip
Calibrate findMember logging thresholds and test case
Adds IterableSelfRec.scala which caused lockup of the compiler. After a lot of work the problem was determined to be polyomial or exponential behavior of the compiler when executing findMember on refined types that contain several bindings where the resutling & causes a recursive invokation of findMember with the same name. We do have a stop for this now, but if the stop comes too late the runtime will grow very fast. Problem addressed by kiccking in earlier with the stopping logic.
Diffstat (limited to 'src/dotty/tools/dotc/config/Config.scala')
-rw-r--r--src/dotty/tools/dotc/config/Config.scala14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/config/Config.scala b/src/dotty/tools/dotc/config/Config.scala
index c00b06913..27d5effa5 100644
--- a/src/dotty/tools/dotc/config/Config.scala
+++ b/src/dotty/tools/dotc/config/Config.scala
@@ -85,9 +85,17 @@ object Config {
/** 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
+ /** How many recursive calls to findMember are performed before logging names starts
+ * Note: this threshold has to be chosen carefully. Too large, and programs
+ * like tests/pos/IterableSelfRec go into polynomial (or even exponential?)
+ * compile time slowdown. Too small and normal programs will cause the compiler to
+ * do inefficient operations on findMember. The current value is determined
+ * so that (1) IterableSelfRec still compiles in reasonable time (< 10sec) (2) Compiling
+ * dotty itself only causes small pending names lists to be generated (we measured
+ * at max 6 elements) and these lists are never searched with contains.
+ */
+ final val LogPendingFindMemberThreshold = 10
/** Maximal number of outstanding recursive calls to findMember */
- final val PendingFindMemberLimit = LogPendingFindMemberThreshold * 2
+ final val PendingFindMemberLimit = LogPendingFindMemberThreshold * 4
}