diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 17 |
2 files changed, 7 insertions, 18 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index d9e26a08a8..2ff0c1926c 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -80,9 +80,7 @@ trait TypeKinds { self: ICodes => */ def isIntSizedType: Boolean = false - /** On the JVM, - * similar to isIntSizedType except that BOOL isn't integral while LONG is. - */ + /** On the JVM, similar to isIntSizedType except that BOOL isn't integral while LONG is. */ def isIntegralType: Boolean = false /** On the JVM, FLOAT and DOUBLE. */ @@ -96,9 +94,7 @@ trait TypeKinds { self: ICodes => case _ => this eq other }) - /** Is this type a category 2 type in JVM terms? - * (ie, is is LONG or DOUBLE?) - */ + /** Is this type a category 2 type in JVM terms? (ie, is it LONG or DOUBLE?) */ def isWideType: Boolean = false /** The number of dimensions for array types. */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 08dfc18706..dc8526c73a 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1564,16 +1564,12 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with jcode.emitATHROW() case DROP(kind) => - kind match { - case LONG | DOUBLE => jcode.emitPOP2() - case _ => jcode.emitPOP() - } + if(kind.isWideType) jcode.emitPOP2() + else jcode.emitPOP() case DUP(kind) => - kind match { - case LONG | DOUBLE => jcode.emitDUP2() - case _ => jcode.emitDUP() - } + if(kind.isWideType) jcode.emitDUP2() + else jcode.emitDUP() case MONITOR_ENTER() => jcode.emitMONITORENTER() @@ -1875,10 +1871,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with def sizeOf(sym: Symbol): Int = sizeOf(toTypeKind(sym.tpe)) - def sizeOf(k: TypeKind): Int = k match { - case DOUBLE | LONG => 2 - case _ => 1 - } + def sizeOf(k: TypeKind): Int = if(k.isWideType) 2 else 1 def indexOf(m: IMethod, sym: Symbol): Int = { val Some(local) = m lookupLocal sym |