@@ -100,7 +100,7 @@ class InlinerTest extends ClearAfterClass {
100100 val g = inlineTest(code)
101101
102102 val gConv = convertMethod(g)
103- assertSameCode(gConv.instructions.dropNonOp ,
103+ assertSameCode(gConv,
104104 List (
105105 VarOp (ALOAD , 0 ), VarOp (ASTORE , 1 ), // store this
106106 Op (ICONST_1 ), VarOp (ISTORE , 2 ), Jump (GOTO , Label (10 )), // store return value
@@ -144,10 +144,10 @@ class InlinerTest extends ClearAfterClass {
144144 VarOp (ALOAD , 2 ),
145145 Op (ATHROW ))
146146
147- assertSameCode(convertMethod(g).instructions.dropNonOp , gBeforeLocalOpt)
147+ assertSameCode(convertMethod(g), gBeforeLocalOpt)
148148
149149 compiler.genBCode.bTypes.localOpt.methodOptimizations(g, " C" )
150- assertSameCode(convertMethod(g).instructions.dropNonOp , invokeQQQ :+ Op (ATHROW ))
150+ assertSameCode(convertMethod(g), invokeQQQ :+ Op (ATHROW ))
151151 }
152152
153153 @ Test
@@ -1313,60 +1313,40 @@ class InlinerTest extends ClearAfterClass {
13131313 """ .stripMargin
13141314 val List (c, _, _) = compile(code)
13151315
1316- assertEquals(getSingleMethod(c, " t1" ).instructions.summary,
1317- List (BIPUSH , " C$$$anonfun$1" , IRETURN ))
1318-
1319- assertEquals(getSingleMethod(c, " t1a" ).instructions.summary,
1320- List (LCONST_1 , " C$$$anonfun$2" , IRETURN ))
1321-
1322- assertEquals(getSingleMethod(c, " t2" ).instructions.summary, List (
1323- ICONST_1 , ICONST_2 , " C$$$anonfun$3" ,IRETURN ))
1316+ assertSameSummary(getSingleMethod(c, " t1" ), List (BIPUSH , " C$$$anonfun$1" , IRETURN ))
1317+ assertSameSummary(getSingleMethod(c, " t1a" ), List (LCONST_1 , " C$$$anonfun$2" , IRETURN ))
1318+ assertSameSummary(getSingleMethod(c, " t2" ), List (ICONST_1 , ICONST_2 , " C$$$anonfun$3" ,IRETURN ))
13241319
13251320 // val a = new ValKl(n); new ValKl(anonfun(a.x)).x
13261321 // value class instantiation-extraction should be optimized by boxing elim
1327- assertEquals (getSingleMethod(c, " t3" ).instructions.summary , List (
1322+ assertSameSummary (getSingleMethod(c, " t3" ), List (
13281323 NEW , DUP , ICONST_1 , " <init>" , ASTORE ,
13291324 NEW , DUP , ALOAD , " x" ,
13301325 " C$$$anonfun$4" ,
13311326 " <init>" ,
13321327 " x" , IRETURN ))
13331328
1334- assertEquals(getSingleMethod(c, " t4" ).instructions.summary, List (
1335- BIPUSH , " C$$$anonfun$5" , " boxToInteger" , ARETURN ))
1336-
1337- assertEquals(getSingleMethod(c, " t4a" ).instructions.summary, List (
1338- ICONST_1 , LDC , " C$$$anonfun$6" , LRETURN ))
1339-
1340- assertEquals(getSingleMethod(c, " t5" ).instructions.summary, List (
1341- BIPUSH , ICONST_3 , " C$$$anonfun$7" , " boxToInteger" , ARETURN ))
1342-
1343- assertEquals(getSingleMethod(c, " t5a" ).instructions.summary, List (
1344- BIPUSH , BIPUSH , I2B , " C$$$anonfun$8" , IRETURN ))
1345-
1346- assertEquals(getSingleMethod(c, " t6" ).instructions.summary, List (
1347- BIPUSH , " C$$$anonfun$9" , RETURN ))
1348-
1349- assertEquals(getSingleMethod(c, " t7" ).instructions.summary, List (
1350- ICONST_1 , " C$$$anonfun$10" , RETURN ))
1351-
1352- assertEquals(getSingleMethod(c, " t8" ).instructions.summary, List (
1353- ICONST_1 , LDC , " C$$$anonfun$11" , LRETURN ))
1354-
1355- assertEquals(getSingleMethod(c, " t9" ).instructions.summary, List (
1356- ICONST_1 , " boxToInteger" , " C$$$anonfun$12" , RETURN ))
1329+ assertSameSummary(getSingleMethod(c, " t4" ), List (BIPUSH , " C$$$anonfun$5" , " boxToInteger" , ARETURN ))
1330+ assertSameSummary(getSingleMethod(c, " t4a" ), List (ICONST_1 , LDC , " C$$$anonfun$6" , LRETURN ))
1331+ assertSameSummary(getSingleMethod(c, " t5" ), List (BIPUSH , ICONST_3 , " C$$$anonfun$7" , " boxToInteger" , ARETURN ))
1332+ assertSameSummary(getSingleMethod(c, " t5a" ), List (BIPUSH , BIPUSH , I2B , " C$$$anonfun$8" , IRETURN ))
1333+ assertSameSummary(getSingleMethod(c, " t6" ), List (BIPUSH , " C$$$anonfun$9" , RETURN ))
1334+ assertSameSummary(getSingleMethod(c, " t7" ), List (ICONST_1 , " C$$$anonfun$10" , RETURN ))
1335+ assertSameSummary(getSingleMethod(c, " t8" ), List (ICONST_1 , LDC , " C$$$anonfun$11" , LRETURN ))
1336+ assertSameSummary(getSingleMethod(c, " t9" ), List (ICONST_1 , " boxToInteger" , " C$$$anonfun$12" , RETURN ))
13571337
13581338 // t9a inlines Range.foreach, which is quite a bit of code, so just testing the core
13591339 assertInvoke(getSingleMethod(c, " t9a" ), " C" , " C$$$anonfun$13" )
1360- assert (getSingleMethod(c, " t9a" ).instructions.summary.contains( " boxToInteger" ) )
1340+ assertInvoke (getSingleMethod(c, " t9a" ), " scala/runtime/BoxesRunTime " , " boxToInteger" )
13611341
1362- assertEquals (getSingleMethod(c, " t10" ).instructions.summary , List (
1342+ assertSameSummary (getSingleMethod(c, " t10" ), List (
13631343 ICONST_1 , ISTORE ,
13641344 ALOAD , ILOAD ,
13651345 " C$$$anonfun$14" , RETURN ))
13661346
13671347 // t10a inlines Range.foreach
13681348 assertInvoke(getSingleMethod(c, " t10a" ), " C" , " C$$$anonfun$15" )
1369- assert( ! getSingleMethod(c, " t10a" ).instructions.summary.contains( " boxToInteger" ) )
1349+ assertDoesNotInvoke( getSingleMethod(c, " t10a" ), " boxToInteger" )
13701350 }
13711351
13721352 @ Test
@@ -1389,7 +1369,7 @@ class InlinerTest extends ClearAfterClass {
13891369 |}
13901370 """ .stripMargin
13911371 val List (c) = compile(code)
1392- assertSameCode(getSingleMethod(c, " t1" ).instructions.dropNonOp , List (Op (ICONST_0 ), Op (ICONST_1 ), Op (IADD ), Op (IRETURN )))
1372+ assertSameCode(getSingleMethod(c, " t1" ), List (Op (ICONST_0 ), Op (ICONST_1 ), Op (IADD ), Op (IRETURN )))
13931373 assertEquals(getSingleMethod(c, " t2" ).instructions collect { case i : Invoke => i.owner + " ." + i.name }, List (
13941374 " scala/runtime/IntRef.create" , " C.C$$$anonfun$1" ))
13951375 }
@@ -1430,9 +1410,9 @@ class InlinerTest extends ClearAfterClass {
14301410 |}
14311411 """ .stripMargin
14321412 val List (c) = compile(code)
1433- assertSameCode(getSingleMethod(c, " t1" ).instructions.dropNonOp , List (Op (ICONST_3 ), Op (ICONST_4 ), Op (IADD ), Op (IRETURN )))
1434- assertSameCode(getSingleMethod(c, " t2" ).instructions.dropNonOp , List (Op (ICONST_1 ), Op (ICONST_2 ), Op (IADD ), Op (IRETURN )))
1435- assertSameCode(getSingleMethod(c, " t3" ).instructions.dropNonOp , List (Op (ICONST_1 ), Op (ICONST_3 ), Op (ISUB ), Op (IRETURN )))
1413+ assertSameCode(getSingleMethod(c, " t1" ), List (Op (ICONST_3 ), Op (ICONST_4 ), Op (IADD ), Op (IRETURN )))
1414+ assertSameCode(getSingleMethod(c, " t2" ), List (Op (ICONST_1 ), Op (ICONST_2 ), Op (IADD ), Op (IRETURN )))
1415+ assertSameCode(getSingleMethod(c, " t3" ), List (Op (ICONST_1 ), Op (ICONST_3 ), Op (ISUB ), Op (IRETURN )))
14361416 assertNoInvoke(getSingleMethod(c, " t4" ))
14371417 assertNoInvoke(getSingleMethod(c, " t5" ))
14381418 }
@@ -1461,9 +1441,9 @@ class InlinerTest extends ClearAfterClass {
14611441 """ .stripMargin
14621442 val List (c, _) = compile(code)
14631443 def casts (m : String ) = getSingleMethod(c, m).instructions collect { case TypeOp (CHECKCAST , tp) => tp }
1464- assertSameCode(getSingleMethod(c, " t1" ).instructions.dropNonOp , List (VarOp (ALOAD , 1 ), Op (ARETURN )))
1465- assertSameCode(getSingleMethod(c, " t2" ).instructions.dropNonOp , List (VarOp (ALOAD , 1 ), Op (ARETURN )))
1466- assertSameCode(getSingleMethod(c, " t3" ).instructions.dropNonOp , List (VarOp (ALOAD , 1 ), TypeOp (CHECKCAST , " C" ), Op (ARETURN )))
1444+ assertSameCode(getSingleMethod(c, " t1" ), List (VarOp (ALOAD , 1 ), Op (ARETURN )))
1445+ assertSameCode(getSingleMethod(c, " t2" ), List (VarOp (ALOAD , 1 ), Op (ARETURN )))
1446+ assertSameCode(getSingleMethod(c, " t3" ), List (VarOp (ALOAD , 1 ), TypeOp (CHECKCAST , " C" ), Op (ARETURN )))
14671447 assertEquals(casts(" t4" ), List (" C" ))
14681448 assertEquals(casts(" t5" ), Nil )
14691449 assertEquals(casts(" t6" ), Nil )
@@ -1489,12 +1469,11 @@ class InlinerTest extends ClearAfterClass {
14891469
14901470 val cls = compile(code)
14911471 val test = cls.find(_.name == " Test$" ).get
1492- assertEquals(
1493- getSingleMethod(test, " f" ).instructions.summary,
1494- List (GETSTATIC , " mkFoo" ,
1495- BIPUSH , ISTORE ,
1496- IFNONNULL , ACONST_NULL , ATHROW , - 1 /* label*/ ,
1497- ILOAD , ICONST_1 , IADD , IRETURN ))
1472+ assertSameSummary(getSingleMethod(test, " f" ), List (
1473+ GETSTATIC , " mkFoo" ,
1474+ BIPUSH , ISTORE ,
1475+ IFNONNULL , ACONST_NULL , ATHROW , - 1 /* label*/ ,
1476+ ILOAD , ICONST_1 , IADD , IRETURN ))
14981477 }
14991478
15001479 @ Test // a test taken from the test suite for the 2.11 inliner
@@ -1509,11 +1488,10 @@ class InlinerTest extends ClearAfterClass {
15091488 val List (c) = compile(code)
15101489
15111490 // box-unbox will clean it up
1512- assertEquals(getSingleMethod(c, " t" ).instructions.summary,
1513- List (
1514- ALOAD , " C$$$anonfun$1" , IFEQ /* A*/ ,
1515- " C$$$anonfun$2" , IRETURN ,
1516- - 1 /* A*/ , " C$$$anonfun$3" , IRETURN ))
1491+ assertSameSummary(getSingleMethod(c, " t" ), List (
1492+ ALOAD , " C$$$anonfun$1" , IFEQ /* A*/ ,
1493+ " C$$$anonfun$2" , IRETURN ,
1494+ - 1 /* A*/ , " C$$$anonfun$3" , IRETURN ))
15171495 }
15181496
15191497 @ Test
0 commit comments