Skip to content

Commit 4c33a55

Browse files
committed
Minor cleanups in GenBCode
1 parent f510aa5 commit 4c33a55

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -883,25 +883,22 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
883883
*
884884
* must-single-thread
885885
*/
886-
private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, module: Symbol, m: Symbol): Unit = {
887-
def staticForwarderGenericSignature(sym: Symbol, moduleClass: Symbol): String = {
888-
if (sym.isDeferred) null // only add generic signature if method concrete; bug #1745
889-
else {
890-
// SI-3452 Static forwarder generation uses the same erased signature as the method if forwards to.
891-
// By rights, it should use the signature as-seen-from the module class, and add suitable
892-
// primitive and value-class boxing/unboxing.
893-
// But for now, just like we did in mixin, we just avoid writing a wrong generic signature
894-
// (one that doesn't erase to the actual signature). See run/t3452b for a test case.
895-
val memberTpe = enteringErasure(moduleClass.thisType.memberInfo(sym))
896-
val erasedMemberType = erasure.erasure(sym)(memberTpe)
897-
if (erasedMemberType =:= sym.info)
898-
getGenericSignature(sym, moduleClass, memberTpe)
899-
else null
900-
}
886+
private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, moduleClass: Symbol, m: Symbol): Unit = {
887+
def staticForwarderGenericSignature: String = {
888+
// SI-3452 Static forwarder generation uses the same erased signature as the method if forwards to.
889+
// By rights, it should use the signature as-seen-from the module class, and add suitable
890+
// primitive and value-class boxing/unboxing.
891+
// But for now, just like we did in mixin, we just avoid writing a wrong generic signature
892+
// (one that doesn't erase to the actual signature). See run/t3452b for a test case.
893+
val memberTpe = enteringErasure(moduleClass.thisType.memberInfo(m))
894+
val erasedMemberType = erasure.erasure(m)(memberTpe)
895+
if (erasedMemberType =:= m.info)
896+
getGenericSignature(m, moduleClass, memberTpe)
897+
else null
901898
}
902899

903-
val moduleName = internalName(module)
904-
val methodInfo = module.thisType.memberInfo(m)
900+
val moduleName = internalName(moduleClass)
901+
val methodInfo = moduleClass.thisType.memberInfo(m)
905902
val paramJavaTypes: List[BType] = methodInfo.paramTypes map typeToBType
906903
// val paramNames = 0 until paramJavaTypes.length map ("x_" + _)
907904

@@ -916,7 +913,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
916913
)
917914

918915
// TODO needed? for(ann <- m.annotations) { ann.symbol.initialize }
919-
val jgensig = staticForwarderGenericSignature(m, module)
916+
val jgensig = staticForwarderGenericSignature
920917
addRemoteExceptionAnnot(isRemoteClass, hasPublicBitSet(flags), m)
921918
val (throws, others) = m.annotations partition (_.symbol == definitions.ThrowsClass)
922919
val thrownExceptions: List[String] = getExceptions(throws)
@@ -937,7 +934,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
937934

938935
mirrorMethod.visitCode()
939936

940-
mirrorMethod.visitFieldInsn(asm.Opcodes.GETSTATIC, moduleName, strMODULE_INSTANCE_FIELD, classBTypeFromSymbol(module).descriptor)
937+
mirrorMethod.visitFieldInsn(asm.Opcodes.GETSTATIC, moduleName, strMODULE_INSTANCE_FIELD, classBTypeFromSymbol(moduleClass).descriptor)
941938

942939
var index = 0
943940
for(jparamType <- paramJavaTypes) {

0 commit comments

Comments
 (0)