diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-08-27 22:12:28 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-09-17 22:05:04 +0200 |
commit | c35c9c77a976b06aeae04d15493ec4995a2a6448 (patch) | |
tree | 36645b8e8791b9c809ab803033a1260df26f0b8a /src | |
parent | 9dd5f95f956fbfd1dc4bab0c7ef69cc60bf85f2c (diff) | |
download | scala-c35c9c77a976b06aeae04d15493ec4995a2a6448.tar.gz scala-c35c9c77a976b06aeae04d15493ec4995a2a6448.tar.bz2 scala-c35c9c77a976b06aeae04d15493ec4995a2a6448.zip |
Revert workaround for SI-8334
The new optimizer doesn't have this problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala | 12 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/List.scala | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala index bf19bece8b..f9ba109358 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala @@ -239,6 +239,17 @@ class CallGraph[BT <: BTypes](val btypes: BT) { // (1) A non-final method can be safe to inline if the receiver type is a final subclass. Example: // class A { @inline def f = 1 }; object B extends A; B.f // can be inlined // + // TODO: (1) doesn't cover the following example: + // trait TravLike { def map = ... } + // sealed trait List extends TravLike { ... } // assume map is not overridden + // final case class :: / final case object Nil + // (l: List).map // can be inlined + // we need to know that + // - the recevier is sealed + // - what are the children of the receiver + // - all children are final + // - none of the children overrides map + // // TODO: type analysis can render more calls statically resolved. Example: // new A.f // can be inlined, the receiver type is known to be exactly A. val isStaticallyResolved: Boolean = { @@ -336,6 +347,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) { higherOrderParams: IntMap[ClassBType], calleeInfoWarning: Option[CalleeInfoWarning]) { assert(!(safeToInline && safeToRewrite), s"A callee of ${callee.name} can be either safeToInline or safeToRewrite, but not both.") + override def toString = s"Callee($calleeDeclarationClass.${callee.name})" } final case class ClosureInstantiation(lambdaMetaFactoryCall: LambdaMetaFactoryCall, ownerMethod: MethodNode, ownerClass: ClassBType) { diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 7b1997252d..eb095dbbc2 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -266,7 +266,6 @@ sealed abstract class List[+A] extends AbstractSeq[A] (b.toList, these) } - @noinline // TODO - fix optimizer bug that requires noinline (see SI-8334) final override def map[B, That](f: A => B)(implicit bf: CanBuildFrom[List[A], B, That]): That = { if (bf eq List.ReusableCBF) { if (this eq Nil) Nil.asInstanceOf[That] else { @@ -285,7 +284,6 @@ sealed abstract class List[+A] extends AbstractSeq[A] else super.map(f) } - @noinline // TODO - fix optimizer bug that requires noinline for map; applied here to be safe (see SI-8334) final override def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[List[A], B, That]): That = { if (bf eq List.ReusableCBF) { if (this eq Nil) Nil.asInstanceOf[That] else { @@ -315,7 +313,6 @@ sealed abstract class List[+A] extends AbstractSeq[A] else super.collect(pf) } - @noinline // TODO - fix optimizer bug that requires noinline for map; applied here to be safe (see SI-8334) final override def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[List[A], B, That]): That = { if (bf eq List.ReusableCBF) { if (this eq Nil) Nil.asInstanceOf[That] else { |