diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-01-22 22:33:29 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-01-23 07:26:13 +0100 |
commit | 8d3be4dc79cb4679fc4994c32b21e10847e5518f (patch) | |
tree | 526242bc68fd901933a961dc14e55633129fb65d /src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala | |
parent | 7443037a6d1376709b3d83f10e66c9155f76dbaa (diff) | |
download | scala-8d3be4dc79cb4679fc4994c32b21e10847e5518f.tar.gz scala-8d3be4dc79cb4679fc4994c32b21e10847e5518f.tar.bz2 scala-8d3be4dc79cb4679fc4994c32b21e10847e5518f.zip |
Harden methods to recognize method invocations to optimize
The previous methods to identify method invocations that can be
optimized, such as `isPredefAutoBox`, were String-based. Now we
obtain class and method signatures from symbols through the
BTypes infrastructure.
We also piggy-back on specialization's type transformer to create
all specialized subclasses of Tuple1/Tuple2. We'll do the same in
the future for FunctionN, but the current JFunctionN are written
in Java and specialized artisanally.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index a2bf8e5725..35b84cc4a9 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -109,7 +109,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { assert(classSym != NoSymbol, "Cannot create ClassBType from NoSymbol") assert(classSym.isClass, s"Cannot create ClassBType from non-class symbol $classSym") assertClassNotArrayNotPrimitive(classSym) - assert(!primitiveTypeMap.contains(classSym) || isCompilingPrimitive, s"Cannot create ClassBType for primitive class symbol $classSym") + assert(!primitiveTypeToBType.contains(classSym) || isCompilingPrimitive, s"Cannot create ClassBType for primitive class symbol $classSym") if (classSym == NothingClass) srNothingRef else if (classSym == NullClass) srNullRef else { @@ -155,7 +155,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { def primitiveOrClassToBType(sym: Symbol): BType = { assertClassNotArray(sym) assert(!sym.isImplClass, sym) - primitiveTypeMap.getOrElse(sym, classBTypeFromSymbol(sym)) + primitiveTypeToBType.getOrElse(sym, classBTypeFromSymbol(sym)) } /** @@ -217,7 +217,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { def assertClassNotArrayNotPrimitive(sym: Symbol): Unit = { assertClassNotArray(sym) - assert(!primitiveTypeMap.contains(sym) || isCompilingPrimitive, sym) + assert(!primitiveTypeToBType.contains(sym) || isCompilingPrimitive, sym) } private def setClassInfo(classSym: Symbol, classBType: ClassBType): ClassBType = { @@ -240,7 +240,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { superClassSym == ObjectClass else // A ClassBType for a primitive class (scala.Boolean et al) is only created when compiling these classes. - ((superClassSym != NoSymbol) && !superClassSym.isInterface) || (isCompilingPrimitive && primitiveTypeMap.contains(classSym)), + ((superClassSym != NoSymbol) && !superClassSym.isInterface) || (isCompilingPrimitive && primitiveTypeToBType.contains(classSym)), s"Bad superClass for $classSym: $superClassSym" ) val superClass = if (superClassSym == NoSymbol) None |