diff options
5 files changed, 10 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index ba97cf3748..daf36ce374 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -824,7 +824,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { * the stack. "Phantom" because it never exists: such methods always throw, but the JVM does * not know that. * - * Note: The two verifiers (old: type inference, new: type checking) have differnet + * Note: The two verifiers (old: type inference, new: type checking) have different * requirements. Very briefly: * * Old (http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.2.1): at @@ -832,7 +832,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { * - Stack is same size and has same typed values * - Local and stack values need to have consistent types * - In practice, the old verifier seems to ignore unreachable code and accept any - * instrucitons after an ATHROW. For example, there can be another ATHROW (without + * instructions after an ATHROW. For example, there can be another ATHROW (without * loading another throwable first). * * New (http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.1) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala b/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala index d96ee933b7..4b9383c67c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala @@ -17,10 +17,8 @@ object BackendStats { val bcodeDceTimer = newSubTimer("dead code elimination", bcodeTimer) val bcodeWriteTimer = newSubTimer("classfile writing", bcodeTimer) - def timed[T](timer: Statistics.Timer)(body: => T) = { + def timed[T](timer: Statistics.Timer)(body: => T): T = { val start = Statistics.startTimer(timer) - val res = body - Statistics.stopTimer(timer, start) - res + try body finally Statistics.stopTimer(timer, start) } } diff --git a/src/partest-extras/scala/tools/partest/ASMConverters.scala b/src/partest-extras/scala/tools/partest/ASMConverters.scala index d443a31112..67a4e8ae01 100644 --- a/src/partest-extras/scala/tools/partest/ASMConverters.scala +++ b/src/partest-extras/scala/tools/partest/ASMConverters.scala @@ -141,9 +141,9 @@ object ASMConverters { } def sameVar(v1: Int, v2: Int) = same(v1, v2, varMap) def sameLabel(l1: Label, l2: Label) = same(l1.offset, l2.offset, labelMap) - def sameLabels(ls1: List[Label], ls2: List[Label]) = ls1.length == ls2.length && (ls1, ls2).zipped.forall(sameLabel) + def sameLabels(ls1: List[Label], ls2: List[Label]) = (ls1 corresponds ls2)(sameLabel) - def sameFrameTypes(ts1: List[Any], ts2: List[Any]) = ts1.length == ts2.length && (ts1, ts2).zipped.forall { + def sameFrameTypes(ts1: List[Any], ts2: List[Any]) = (ts1 corresponds ts2) { case (t1: Label, t2: Label) => sameLabel(t1, t2) case (x, y) => x == y } diff --git a/src/partest-extras/scala/tools/partest/BytecodeTest.scala b/src/partest-extras/scala/tools/partest/BytecodeTest.scala index c6fa279c50..3261cada37 100644 --- a/src/partest-extras/scala/tools/partest/BytecodeTest.scala +++ b/src/partest-extras/scala/tools/partest/BytecodeTest.scala @@ -84,7 +84,7 @@ abstract class BytecodeTest { /** * Compare the bytecodes of two methods. * - * The for the `similar` function, you probably want to pass [[ASMConverters.equivalentBytecode]]. + * For the `similar` function, you probably want to pass [[ASMConverters.equivalentBytecode]]. */ def similarBytecode(methA: MethodNode, methB: MethodNode, similar: (List[Instruction], List[Instruction]) => Boolean) = { val isa = instructionsFromMethod(methA) diff --git a/test/files/run/nothingTypeDce.scala b/test/files/run/nothingTypeDce.scala index 4b9d934eac..5f3692fd33 100644 --- a/test/files/run/nothingTypeDce.scala +++ b/test/files/run/nothingTypeDce.scala @@ -26,7 +26,7 @@ class C { } def f5(x: Boolean) = { - // stack heights need to be the smae. ??? looks to the jvm like returning a value of + // stack heights need to be the same. ??? looks to the jvm like returning a value of // type Nothing$, need to drop or throw it. println( if (x) { ???; 10 } @@ -57,5 +57,7 @@ class C { } object Test extends App { + // creating an instance is enough to trigger bytecode verification for all methods, + // no need to invoke the methods. new C() } |