diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala | 23 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala | 2 |
2 files changed, 7 insertions, 18 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index e635708a94..1ec9ba8a95 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -31,9 +31,8 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { * True for classes generated by the Scala compiler that are considered top-level in terms of * the InnerClass / EnclosingMethod classfile attributes. See comment in BTypes. */ - def considerAsTopLevelImplementationArtifact(classSym: Symbol) = { + def considerAsTopLevelImplementationArtifact(classSym: Symbol) = classSym.isImplClass || classSym.isSpecialized - } /** * Cache the value of delambdafy == "inline" for each run. We need to query this value many @@ -846,8 +845,6 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { trait BCJGenSigGen { - def getCurrentCUnit(): CompilationUnit - // @M don't generate java generics sigs for (members of) implementation // classes, as they are monomorphic (TODO: ok?) private def needsGenericSignature(sym: Symbol) = !( @@ -870,14 +867,12 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { * * must-single-thread */ - def getGenericSignature(sym: Symbol, owner: Symbol): String = getGenericSignature(sym, owner, getCurrentCUnit()) - - def getGenericSignature(sym: Symbol, owner: Symbol, unit: CompilationUnit): String = { + def getGenericSignature(sym: Symbol, owner: Symbol): String = { val memberTpe = enteringErasure(owner.thisType.memberInfo(sym)) - getGenericSignature(sym, owner, memberTpe, unit) + getGenericSignature(sym, owner, memberTpe) } - def getGenericSignature(sym: Symbol, owner: Symbol, memberTpe: Type, unit: CompilationUnit): String = { + def getGenericSignature(sym: Symbol, owner: Symbol, memberTpe: Type): String = { if (!needsGenericSignature(sym)) { return null } val jsOpt: Option[String] = erasure.javaSig(sym, memberTpe) @@ -962,7 +957,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { * must-single-thread */ private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, module: Symbol, m: Symbol): Unit = { - def staticForwarderGenericSignature(sym: Symbol, moduleClass: Symbol, unit: CompilationUnit): String = { + def staticForwarderGenericSignature(sym: Symbol, moduleClass: Symbol): String = { if (sym.isDeferred) null // only add generic signature if method concrete; bug #1745 else { // SI-3452 Static forwarder generation uses the same erased signature as the method if forwards to. @@ -973,7 +968,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { val memberTpe = enteringErasure(moduleClass.thisType.memberInfo(sym)) val erasedMemberType = erasure.erasure(sym)(memberTpe) if (erasedMemberType =:= sym.info) - getGenericSignature(sym, moduleClass, memberTpe, unit) + getGenericSignature(sym, moduleClass, memberTpe) else null } } @@ -994,7 +989,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { ) // TODO needed? for(ann <- m.annotations) { ann.symbol.initialize } - val jgensig = staticForwarderGenericSignature(m, module, getCurrentCUnit()) + val jgensig = staticForwarderGenericSignature(m, module) addRemoteExceptionAnnot(isRemoteClass, hasPublicBitSet(flags), m) val (throws, others) = m.annotations partition (_.symbol == definitions.ThrowsClass) val thrownExceptions: List[String] = getExceptions(throws) @@ -1117,9 +1112,6 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { /* builder of mirror classes */ class JMirrorBuilder extends JCommonBuilder { - private var cunit: CompilationUnit = _ - def getCurrentCUnit(): CompilationUnit = cunit; - /* Generate a mirror class for a top-level module. A mirror class is a class * containing only static methods that forward to the corresponding method * on the MODULE instance of the given Scala object. It will only be @@ -1131,7 +1123,6 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { def genMirrorClass(moduleClass: Symbol, cunit: CompilationUnit): asm.tree.ClassNode = { assert(moduleClass.isModuleClass) assert(moduleClass.companionClass == NoSymbol, moduleClass) - this.cunit = cunit val bType = mirrorClassClassBType(moduleClass) val mirrorClass = new asm.tree.ClassNode diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index abd06b90a0..7180c25d25 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -82,8 +82,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { global synchronized { global.log(msg) } } - override def getCurrentCUnit(): CompilationUnit = { cunit } - /* ---------------- helper utils for generating classes and fields ---------------- */ def genPlainClass(cd: ClassDef) { |