diff options
3 files changed, 3 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala index 149742888a..f91530903d 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala @@ -382,10 +382,6 @@ class CopyProp[BT <: BTypes](val btypes: BT) { popAfterProd() } - case NEWARRAY | ANEWARRAY => - toRemove += prod - handleInputs(prod, 1) - case MULTIANEWARRAY => toRemove += prod handleInputs(prod, prod.asInstanceOf[MultiANewArrayInsnNode].dims) diff --git a/test/files/jvm/bytecode-test-example.flags b/test/files/jvm/bytecode-test-example.flags new file mode 100644 index 0000000000..bc22511cff --- /dev/null +++ b/test/files/jvm/bytecode-test-example.flags @@ -0,0 +1 @@ +-Yopt:l:none diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala index 5ee52ff78f..ec063c6cb3 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala @@ -161,7 +161,7 @@ class MethodLevelOptsTest extends ClearAfterClass { | val b = (a, y) // Tuple2 | val c = (new Object, "krik", new String) // unused java/lang/Object, java/lang/String allocation and string constant is also eliminated | val d = new java.lang.Integer(x) - | val e = new String(new Array[Char](23)) + | val e = new String(new Array[Char](23)) // array allocation not eliminated, as it may throw (negative size, SI-8601) | val f = new scala.runtime.IntRef(11) | x + y | } @@ -169,7 +169,7 @@ class MethodLevelOptsTest extends ClearAfterClass { """.stripMargin val List(c) = compileClasses(methodOptCompiler)(code) assertEquals(getSingleMethod(c, "t").instructions.dropNonOp, - List(VarOp(ILOAD, 1), VarOp(ILOAD, 2), Op(IADD), Op(IRETURN))) + List(IntOp(BIPUSH, 23), IntOp(NEWARRAY, 5), Op(POP), VarOp(ILOAD, 1), VarOp(ILOAD, 2), Op(IADD), Op(IRETURN))) } @Test |