Permalink
Browse files

Fix for exponential compile time in specialization.

Review by @prokopec.
  • Loading branch information...
1 parent 0a9cea6 commit 39f01d4f48e59c2037a3af759eb6d55d0da50e70 @paulp paulp committed Jul 1, 2012
@@ -1366,7 +1366,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
override def transform(tree: Tree): Tree =
reportError { transform1(tree) } {_ => tree}
-
+
def transform1(tree: Tree) = {
val symbol = tree.symbol
@@ -1437,7 +1437,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method
}
- case None => super.transform(tree)
+ case None =>
+ treeCopy.TypeApply(tree, treeCopy.Select(sel, qual1, name), super.transformTrees(targs))
+ // See pos/exponential-spec.scala - can't call transform on the whole tree again.
+ // super.transform(tree)
}
case Select(Super(_, _), name) if illegalSpecializedInheritance(currentClass) =>
@@ -0,0 +1,47 @@
+// a.scala
+// Sat Jun 30 19:51:17 PDT 2012
+
+trait Exp[T]
+
+object Test {
+ def f[T](exp: Exp[T]): Exp[T] = (
+ f[T] _
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T] // 4s
+ compose f[T] // 5s
+ compose f[T] // 5s
+ compose f[T] // 6s
+ compose f[T] // 7s
+ compose f[T] // 8s
+ compose f[T] // 11s
+ compose f[T] // 17s
+ compose f[T] // 29s
+ compose f[T] // 54s
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ )(exp)
+}

0 comments on commit 39f01d4

Please sign in to comment.