diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-06 14:15:28 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-06 14:15:28 +0100 |
commit | 46fc45e62a1f4ae5a17f5abcb346ff49cff5a7ea (patch) | |
tree | 40d43067ae2b17417b0d5bcb1d3cf49b9192edb2 /src | |
parent | ed3709a5dfd84f073a9a99e43418f693adbac07c (diff) | |
download | scala-46fc45e62a1f4ae5a17f5abcb346ff49cff5a7ea.tar.gz scala-46fc45e62a1f4ae5a17f5abcb346ff49cff5a7ea.tar.bz2 scala-46fc45e62a1f4ae5a17f5abcb346ff49cff5a7ea.zip |
Revert "Expand optimization of Array(e1, ..., en) to primitive arrays."
This reverts commit 8265175ecc42293997d59049f430396c77a2b891.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 7 | ||||
-rw-r--r-- | src/library/scala/Array.scala | 10 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 13 |
3 files changed, 6 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 6af7b78181..122a37c0c6 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -629,13 +629,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { _.tpe.resultType.dealias.typeSymbol == ObjectClass // [T: ClassTag](xs: T*): Array[T] post erasure }) => super.transform(arg) - case Apply(appMeth, List(elem0, Apply(wrapArrayMeth, List(rest @ ArrayValue(elemtpt, _))))) - if wrapArrayMeth.symbol == Predef_wrapArray(elemtpt.tpe) && - appMeth.symbol == ArrayModule_overloadedApply.suchThat { - tp => tp.tpe.paramss.flatten.lift.apply(1).exists(_.tpe.typeSymbol == SeqClass) && - tp.tpe.resultType =:= arrayType(elemtpt.tpe) // (p1: AnyVal1, ps: AnyVal1*): Array[AnyVal1] post erasure - } => - super.transform(rest.copy(elems = elem0 :: rest.elems)) case _ => super.transform(tree) diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala index 514844a5fa..0b8550be37 100644 --- a/src/library/scala/Array.scala +++ b/src/library/scala/Array.scala @@ -115,8 +115,6 @@ object Array extends FallbackArrayBuilding { * @param xs the elements to put in the array * @return an array containing all elements from xs. */ - // Subject to a compiler optimization in Cleanup. - // Array(e0, ..., en) is translated to { val a = new Array(3); a(i) = ei; a } def apply[T: ClassTag](xs: T*): Array[T] = { val array = new Array[T](xs.length) var i = 0 @@ -125,7 +123,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Boolean` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Boolean, xs: Boolean*): Array[Boolean] = { val array = new Array[Boolean](xs.length + 1) array(0) = x @@ -135,7 +132,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Byte` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Byte, xs: Byte*): Array[Byte] = { val array = new Array[Byte](xs.length + 1) array(0) = x @@ -145,7 +141,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Short` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Short, xs: Short*): Array[Short] = { val array = new Array[Short](xs.length + 1) array(0) = x @@ -155,7 +150,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Char` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Char, xs: Char*): Array[Char] = { val array = new Array[Char](xs.length + 1) array(0) = x @@ -165,7 +159,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Int` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Int, xs: Int*): Array[Int] = { val array = new Array[Int](xs.length + 1) array(0) = x @@ -175,7 +168,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Long` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Long, xs: Long*): Array[Long] = { val array = new Array[Long](xs.length + 1) array(0) = x @@ -185,7 +177,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Float` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Float, xs: Float*): Array[Float] = { val array = new Array[Float](xs.length + 1) array(0) = x @@ -195,7 +186,6 @@ object Array extends FallbackArrayBuilding { } /** Creates an array of `Double` objects */ - // Subject to a compiler optimization in Cleanup, see above. def apply(x: Double, xs: Double*): Array[Double] = { val array = new Array[Double](xs.length + 1) array(0) = x diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 60a1913548..5c982742bc 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -340,13 +340,12 @@ trait Definitions extends api.StandardDefinitions { lazy val PredefModule = requiredModule[scala.Predef.type] lazy val PredefModuleClass = PredefModule.moduleClass - def Predef_classOf = getMemberMethod(PredefModule, nme.classOf) - def Predef_identity = getMemberMethod(PredefModule, nme.identity) - def Predef_conforms = getMemberMethod(PredefModule, nme.conforms) - def Predef_wrapRefArray = getMemberMethod(PredefModule, nme.wrapRefArray) - def Predef_wrapArray(tp: Type) = getMemberMethod(PredefModule, wrapArrayMethodName(tp)) - def Predef_??? = getMemberMethod(PredefModule, nme.???) - def Predef_implicitly = getMemberMethod(PredefModule, nme.implicitly) + def Predef_classOf = getMemberMethod(PredefModule, nme.classOf) + def Predef_identity = getMemberMethod(PredefModule, nme.identity) + def Predef_conforms = getMemberMethod(PredefModule, nme.conforms) + def Predef_wrapRefArray = getMemberMethod(PredefModule, nme.wrapRefArray) + def Predef_??? = getMemberMethod(PredefModule, nme.???) + def Predef_implicitly = getMemberMethod(PredefModule, nme.implicitly) /** Is `sym` a member of Predef with the given name? * Note: DON't replace this by sym == Predef_conforms/etc, as Predef_conforms is a `def` |