diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/innerClassAttribute.check | 4 | ||||
-rw-r--r-- | test/files/jvm/javaReflection.check | 4 | ||||
-rw-r--r-- | test/files/jvm/t9105.check | 4 | ||||
-rw-r--r-- | test/files/run/delambdafy-specialized.flags | 2 | ||||
-rw-r--r-- | test/files/run/delambdafy_t6028.check | 23 | ||||
-rw-r--r-- | test/files/run/inline-ex-handlers.check | 98 | ||||
-rw-r--r-- | test/files/run/inline-ex-handlers.scala | 2 | ||||
-rw-r--r-- | test/files/run/large_class.check | 4 | ||||
-rw-r--r-- | test/files/run/large_code.check | 4 | ||||
-rw-r--r-- | test/files/run/t2106.check | 4 | ||||
-rw-r--r-- | test/files/run/t5313.scala | 2 | ||||
-rw-r--r-- | test/files/run/t6102.check | 4 | ||||
-rw-r--r-- | test/files/run/t6260c.check | 4 | ||||
-rw-r--r-- | test/files/run/t6288b-jump-position.check | 76 | ||||
-rw-r--r-- | test/files/run/t6288b-jump-position.scala | 19 | ||||
-rw-r--r-- | test/files/run/t6955.scala | 2 | ||||
-rw-r--r-- | test/files/run/t6956.scala | 2 | ||||
-rw-r--r-- | test/files/run/test-cpp.check | 20 | ||||
-rw-r--r-- | test/files/run/test-cpp.scala | 2 | ||||
-rw-r--r-- | test/junit/scala/issues/BytecodeTests.scala | 63 |
20 files changed, 145 insertions, 198 deletions
diff --git a/test/files/jvm/innerClassAttribute.check b/test/files/jvm/innerClassAttribute.check index 41448f359b..7c697f9053 100644 --- a/test/files/jvm/innerClassAttribute.check +++ b/test/files/jvm/innerClassAttribute.check @@ -1,4 +1,4 @@ -#partest !-Ydelambdafy:method +#partest -Ydelambdafy:inline -- A4 -- A4$$anonfun$f$1 / null / null / 17 A4$$anonfun$f$1 / null / null / 17 @@ -35,7 +35,7 @@ A20 / null / null A20$$anonfun$4 / null / null A20$$anonfun$4 / null / null A20$$anonfun$4$$anonfun$apply$2 / null / null -#partest -Ydelambdafy:method +#partest !-Ydelambdafy:inline -- A4 -- null / null / null -- A19 -- diff --git a/test/files/jvm/javaReflection.check b/test/files/jvm/javaReflection.check index 8180ecff8a..83518c7990 100644 --- a/test/files/jvm/javaReflection.check +++ b/test/files/jvm/javaReflection.check @@ -1,4 +1,4 @@ -#partest !-Ydelambdafy:method +#partest -Ydelambdafy:inline A$$anonfun$$lessinit$greater$1 / null (canon) / $anonfun$$lessinit$greater$1 (simple) - declared cls: List() - enclosing : null (declaring cls) / class A (cls) / public A(int) (constr) / null (meth) @@ -39,7 +39,7 @@ AT$$anonfun$6 / null (canon) / $anonfun$6 (simple) - declared cls: List() - enclosing : null (declaring cls) / interface AT (cls) / null (constr) / null (meth) - properties : true (local) / false (member) -#partest -Ydelambdafy:method +#partest !-Ydelambdafy:inline A$D$lambda$1 / A$D$lambda$1 (canon) / A$D$lambda$1 (simple) - declared cls: List() - enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth) diff --git a/test/files/jvm/t9105.check b/test/files/jvm/t9105.check index 34750833f1..48439ee004 100644 --- a/test/files/jvm/t9105.check +++ b/test/files/jvm/t9105.check @@ -1,4 +1,4 @@ -#partest !-Ydelambdafy:method +#partest -Ydelambdafy:inline (class C$$anonfun$1$A$1,class C$$anonfun$1,null) (class C$$anonfun$1$B$1,class C$$anonfun$1,private final java.lang.Object C$$anonfun$1.m$1()) (class C$$anonfun$1$C$1,class C$$anonfun$1,null) @@ -7,7 +7,7 @@ (class C$$anonfun$met$1$F$1,class C$$anonfun$met$1,private final java.lang.Object C$$anonfun$met$1.m$2()) (class C$$anonfun$met$1$G$1,class C$$anonfun$met$1,null) (class C$$anonfun$met$1$$anonfun$3$H$1,class C$$anonfun$met$1$$anonfun$3,null) -#partest -Ydelambdafy:method +#partest !-Ydelambdafy:inline (class C$A$1,class C,null) (class C$B$1,class C,private final java.lang.Object C.m$1()) (class C$C$1,class C,null) diff --git a/test/files/run/delambdafy-specialized.flags b/test/files/run/delambdafy-specialized.flags index 48b438ddf8..d6278aa940 100644 --- a/test/files/run/delambdafy-specialized.flags +++ b/test/files/run/delambdafy-specialized.flags @@ -1 +1 @@ --Ydelambdafy:method +-Ydelambdafy:method -Ybackend:GenASM diff --git a/test/files/run/delambdafy_t6028.check b/test/files/run/delambdafy_t6028.check index 419e7043a3..9ff1d0e78e 100644 --- a/test/files/run/delambdafy_t6028.check +++ b/test/files/run/delambdafy_t6028.check @@ -21,7 +21,7 @@ package <empty> { def tryy(tryyParam: String): Function0 = { var tryyLocal: runtime.ObjectRef = scala.runtime.ObjectRef.create(""); { - (new <$anon: Function0>(T.this, tryyParam, tryyLocal): Function0) + (() => T.this.$anonfun$2(tryyParam, tryyLocal)).$asInstanceOf[Function0]() } }; final <artifact> private[this] def $anonfun$1(methodParam$1: String, methodLocal$1: String): String = T.this.classParam.+(T.this.field()).+(methodParam$1).+(methodLocal$1); @@ -48,24 +48,9 @@ package <empty> { }; scala.this.Predef.print(barParam$1) }; - @SerialVersionUID(value = 0) final <synthetic> class $anonfun$tryy$1 extends scala.runtime.AbstractFunction0$mcV$sp with Serializable { - def <init>($outer: T, tryyParam$1: String, tryyLocal$1: runtime.ObjectRef): <$anon: Function0> = { - $anonfun$tryy$1.super.<init>(); - () - }; - final def apply(): Unit = $anonfun$tryy$1.this.apply$mcV$sp(); - <specialized> def apply$mcV$sp(): Unit = try { - $anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1 - } finally (); - <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; - <synthetic> <stable> <artifact> def $outer(): T = $anonfun$tryy$1.this.$outer; - final <bridge> <artifact> def apply(): Object = { - $anonfun$tryy$1.this.apply(); - scala.runtime.BoxedUnit.UNIT - }; - <synthetic> <paramaccessor> private[this] val tryyParam$1: String = _; - <synthetic> <paramaccessor> private[this] val tryyLocal$1: runtime.ObjectRef = _ - } + final <artifact> private[this] def $anonfun$2(tryyParam$1: String, tryyLocal$1: runtime.ObjectRef): Unit = try { + tryyLocal$1.elem = tryyParam$1 + } finally () } } diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check index 27a277d314..36fc2eefa4 100644 --- a/test/files/run/inline-ex-handlers.check +++ b/test/files/run/inline-ex-handlers.check @@ -30,7 +30,7 @@ - - 7: 92 LOAD_LOCAL(value x1) -@@ -390,5 +386,5 @@ +@@ -408,5 +404,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value ex6, value x4, value x5, value message, value x + locals: value args, variable result, value ex6, value x4, value x5, value x @@ -38,7 +38,7 @@ - blocks: [1,2,3,4,5,8,10,11,13] + blocks: [1,2,3,5,8,10,11,13,14] -@@ -416,4 +412,13 @@ +@@ -434,4 +430,13 @@ 103 CALL_METHOD MyException.<init> (static-instance) - 103 THROW(MyException) + ? STORE_LOCAL(value ex6) @@ -53,13 +53,13 @@ + 106 CZJUMP (BOOL)NE ? 5 : 8 + 13: -@@ -429,5 +434,2 @@ +@@ -447,5 +452,2 @@ 101 SCOPE_ENTER value x4 - 101 JUMP 4 - - 4: 106 LOAD_LOCAL(value x4) -@@ -441,8 +443,5 @@ +@@ -459,8 +461,5 @@ 106 SCOPE_ENTER value x5 - 106 LOAD_LOCAL(value x5) - 106 CALL_METHOD MyException.message (dynamic) @@ -70,12 +70,12 @@ + ? LOAD_LOCAL(value x5) + 106 CALL_METHOD MyException.message (dynamic) 106 CALL_METHOD scala.Predef.println (dynamic) -@@ -518,3 +517,3 @@ +@@ -536,3 +535,3 @@ startBlock: 1 - blocks: [1,2,3,4,6,7,9,10] + blocks: [1,3,4,6,7,9,10,11,12,13] -@@ -547,4 +546,9 @@ +@@ -565,4 +564,9 @@ 306 CALL_METHOD MyException.<init> (static-instance) - 306 THROW(MyException) + ? JUMP 11 @@ -86,12 +86,12 @@ + ? JUMP 12 + 9: -@@ -553,3 +557,3 @@ +@@ -571,3 +575,3 @@ 305 MONITOR_EXIT - ? THROW(Throwable) + ? JUMP 12 -@@ -559,4 +563,11 @@ +@@ -577,4 +581,11 @@ 304 MONITOR_EXIT - ? THROW(Throwable) + ? STORE_LOCAL(value t) @@ -104,7 +104,7 @@ + ? JUMP 13 + 3: -@@ -573,5 +584,14 @@ +@@ -591,5 +602,14 @@ 310 CALL_METHOD scala.Predef.println (dynamic) - 310 JUMP 2 + 300 RETURN(UNIT) @@ -121,7 +121,7 @@ + 310 CALL_PRIMITIVE(EndConcat) + 310 CALL_METHOD scala.Predef.println (dynamic) 300 RETURN(UNIT) -@@ -583,6 +603,6 @@ +@@ -601,6 +621,6 @@ with finalizer: null - catch (Throwable) in Vector(7, 9, 10) starting at: 6 + catch (Throwable) in Vector(7, 9, 10, 11) starting at: 6 @@ -130,12 +130,12 @@ - catch (Throwable) in Vector(4, 6, 7, 9, 10) starting at: 3 + catch (Throwable) in Vector(4, 6, 7, 9, 10, 11, 12) starting at: 3 consisting of blocks: List(3) -@@ -618,3 +638,3 @@ +@@ -636,3 +656,3 @@ startBlock: 1 - blocks: [1,3,4,5,6,8,9] + blocks: [1,3,4,5,6,8,9,10,11] -@@ -642,4 +662,10 @@ +@@ -660,4 +680,10 @@ 78 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 78 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) @@ -147,13 +147,13 @@ + ? JUMP 11 + 8: -@@ -668,3 +694,4 @@ +@@ -686,3 +712,4 @@ 81 LOAD_LOCAL(value e) - 81 THROW(Exception) + ? STORE_LOCAL(variable exc1) + ? JUMP 11 -@@ -685,2 +712,15 @@ +@@ -703,2 +730,15 @@ + 11: + 83 LOAD_MODULE object Predef @@ -169,12 +169,12 @@ + 84 THROW(Throwable) + } -@@ -690,3 +730,3 @@ +@@ -708,3 +748,3 @@ with finalizer: null - catch (<none>) in Vector(4, 5, 6, 8) starting at: 3 + catch (<none>) in Vector(4, 5, 6, 8, 10) starting at: 3 consisting of blocks: List(3) -@@ -714,5 +754,5 @@ +@@ -732,5 +772,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x + locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x @@ -182,7 +182,7 @@ - blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24] + blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27] -@@ -740,4 +780,11 @@ +@@ -758,4 +798,11 @@ 172 CALL_METHOD MyException.<init> (static-instance) - 172 THROW(MyException) + ? STORE_LOCAL(value ex6) @@ -195,7 +195,7 @@ + 170 JUMP 14 + 23: -@@ -780,8 +827,5 @@ +@@ -798,8 +845,5 @@ 175 SCOPE_ENTER value x5 - 175 LOAD_LOCAL(value x5) - 175 CALL_METHOD MyException.message (dynamic) @@ -206,7 +206,7 @@ + ? LOAD_LOCAL(value x5) + 176 CALL_METHOD MyException.message (dynamic) 176 CALL_METHOD scala.Predef.println (dynamic) -@@ -789,5 +833,7 @@ +@@ -807,5 +851,7 @@ 177 DUP(REF(class MyException)) - 177 LOAD_LOCAL(value message) + ? LOAD_LOCAL(value x5) @@ -216,13 +216,13 @@ + ? STORE_LOCAL(value ex6) + ? JUMP 26 -@@ -795,3 +841,4 @@ +@@ -813,3 +859,4 @@ 170 LOAD_LOCAL(value ex6) - 170 THROW(Throwable) + ? STORE_LOCAL(value ex6) + ? JUMP 26 -@@ -805,2 +852,8 @@ +@@ -823,2 +870,8 @@ + 26: + 169 LOAD_LOCAL(value ex6) @@ -231,7 +231,7 @@ + 169 JUMP 5 + 5: -@@ -815,8 +868,5 @@ +@@ -833,8 +886,5 @@ 180 SCOPE_ENTER value x5 - 180 LOAD_LOCAL(value x5) - 180 CALL_METHOD MyException.message (dynamic) @@ -242,7 +242,7 @@ + ? LOAD_LOCAL(value x5) + 181 CALL_METHOD MyException.message (dynamic) 181 CALL_METHOD scala.Predef.println (dynamic) -@@ -824,5 +874,7 @@ +@@ -842,5 +892,7 @@ 182 DUP(REF(class MyException)) - 182 LOAD_LOCAL(value message) + ? LOAD_LOCAL(value x5) @@ -252,13 +252,13 @@ + ? STORE_LOCAL(variable exc2) + ? JUMP 27 -@@ -830,3 +882,4 @@ +@@ -848,3 +900,4 @@ 169 LOAD_LOCAL(value ex6) - 169 THROW(Throwable) + ? STORE_LOCAL(variable exc2) + ? JUMP 27 -@@ -847,2 +900,15 @@ +@@ -865,2 +918,15 @@ + 27: + 184 LOAD_MODULE object Predef @@ -274,7 +274,7 @@ + 185 THROW(Throwable) + } -@@ -852,6 +918,6 @@ +@@ -870,6 +936,6 @@ with finalizer: null - catch (Throwable) in Vector(13, 14, 15, 18, 20, 21, 23) starting at: 4 + catch (Throwable) in Vector(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4 @@ -283,7 +283,7 @@ - catch (<none>) in Vector(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3 + catch (<none>) in Vector(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3 consisting of blocks: List(3) -@@ -879,5 +945,5 @@ +@@ -897,5 +963,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x + locals: value args, variable result, value e, value ex6, value x4, value x5, value x @@ -291,7 +291,7 @@ - blocks: [1,2,3,6,7,8,11,13,14,16] + blocks: [1,2,3,6,7,8,11,13,14,16,17] -@@ -905,4 +971,11 @@ +@@ -923,4 +989,11 @@ 124 CALL_METHOD MyException.<init> (static-instance) - 124 THROW(MyException) + ? STORE_LOCAL(value ex6) @@ -304,7 +304,7 @@ + 122 JUMP 7 + 16: -@@ -930,8 +1003,5 @@ +@@ -948,8 +1021,5 @@ 127 SCOPE_ENTER value x5 - 127 LOAD_LOCAL(value x5) - 127 CALL_METHOD MyException.message (dynamic) @@ -315,12 +315,12 @@ + ? LOAD_LOCAL(value x5) + 127 CALL_METHOD MyException.message (dynamic) 127 CALL_METHOD scala.Predef.println (dynamic) -@@ -964,3 +1034,3 @@ +@@ -982,3 +1052,3 @@ with finalizer: null - catch (IllegalArgumentException) in Vector(6, 7, 8, 11, 13, 14, 16) starting at: 3 + catch (IllegalArgumentException) in Vector(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3 consisting of blocks: List(3) -@@ -988,5 +1058,5 @@ +@@ -1006,5 +1076,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e + locals: value args, variable result, value ex6, value x4, value x5, value x, value e @@ -328,7 +328,7 @@ - blocks: [1,2,3,4,5,8,12,13,14,16] + blocks: [1,2,3,5,8,12,13,14,16,17] -@@ -1014,4 +1084,13 @@ +@@ -1032,4 +1102,13 @@ 148 CALL_METHOD MyException.<init> (static-instance) - 148 THROW(MyException) + ? STORE_LOCAL(value ex6) @@ -343,13 +343,13 @@ + 154 CZJUMP (BOOL)NE ? 5 : 8 + 16: -@@ -1035,5 +1114,2 @@ +@@ -1053,5 +1132,2 @@ 145 SCOPE_ENTER value x4 - 145 JUMP 4 - - 4: 154 LOAD_LOCAL(value x4) -@@ -1047,8 +1123,5 @@ +@@ -1065,8 +1141,5 @@ 154 SCOPE_ENTER value x5 - 154 LOAD_LOCAL(value x5) - 154 CALL_METHOD MyException.message (dynamic) @@ -360,12 +360,12 @@ + ? LOAD_LOCAL(value x5) + 154 CALL_METHOD MyException.message (dynamic) 154 CALL_METHOD scala.Predef.println (dynamic) -@@ -1269,3 +1342,3 @@ +@@ -1287,3 +1360,3 @@ startBlock: 1 - blocks: [1,2,3,4,5,7] + blocks: [1,2,3,4,5,7,8] -@@ -1293,4 +1366,11 @@ +@@ -1311,4 +1384,11 @@ 38 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 38 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) @@ -378,7 +378,7 @@ + 42 JUMP 2 + 7: -@@ -1340,5 +1420,5 @@ +@@ -1358,5 +1438,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value ex6, value x4, value x5, value message, value x + locals: value args, variable result, value ex6, value x4, value x5, value x @@ -386,13 +386,13 @@ - blocks: [1,2,3,4,5,8,10,11,13,14,16] + blocks: [1,2,3,5,8,10,11,13,14,16,17] -@@ -1366,3 +1446,4 @@ +@@ -1384,3 +1464,4 @@ 203 CALL_METHOD MyException.<init> (static-instance) - 203 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 17 -@@ -1386,4 +1467,13 @@ +@@ -1404,4 +1485,13 @@ 209 CALL_METHOD MyException.<init> (static-instance) - 209 THROW(MyException) + ? STORE_LOCAL(value ex6) @@ -407,13 +407,13 @@ + 212 CZJUMP (BOOL)NE ? 5 : 8 + 16: -@@ -1399,5 +1489,2 @@ +@@ -1417,5 +1507,2 @@ 200 SCOPE_ENTER value x4 - 200 JUMP 4 - - 4: 212 LOAD_LOCAL(value x4) -@@ -1411,8 +1498,5 @@ +@@ -1429,8 +1516,5 @@ 212 SCOPE_ENTER value x5 - 212 LOAD_LOCAL(value x5) - 212 CALL_METHOD MyException.message (dynamic) @@ -424,12 +424,12 @@ + ? LOAD_LOCAL(value x5) + 213 CALL_METHOD MyException.message (dynamic) 213 CALL_METHOD scala.Predef.println (dynamic) -@@ -1460,3 +1544,3 @@ +@@ -1478,3 +1562,3 @@ startBlock: 1 - blocks: [1,2,3,4,5,7] + blocks: [1,2,3,4,5,7,8] -@@ -1484,4 +1568,11 @@ +@@ -1502,4 +1586,11 @@ 58 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 58 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) @@ -442,12 +442,12 @@ + 62 JUMP 2 + 7: -@@ -1533,3 +1624,3 @@ +@@ -1551,3 +1642,3 @@ startBlock: 1 - blocks: [1,3,4] + blocks: [1,3,4,5] -@@ -1553,4 +1644,9 @@ +@@ -1571,4 +1662,9 @@ 229 CALL_METHOD MyException.<init> (static-instance) - 229 THROW(MyException) + ? JUMP 5 @@ -458,12 +458,12 @@ + 228 THROW(Throwable) + 3: -@@ -1559,3 +1655,3 @@ +@@ -1577,3 +1673,3 @@ 228 MONITOR_EXIT - ? THROW(Throwable) + 228 THROW(Throwable) -@@ -1587,5 +1683,5 @@ +@@ -1605,5 +1701,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, variable monitor2, variable monitorResult1 + locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1 @@ -471,7 +471,7 @@ - blocks: [1,3,4] + blocks: [1,3,4,5] -@@ -1612,4 +1708,12 @@ +@@ -1630,4 +1726,12 @@ 245 CALL_METHOD MyException.<init> (static-instance) - 245 THROW(MyException) + ? STORE_LOCAL(value exception$1) @@ -485,7 +485,7 @@ + 244 THROW(Throwable) + 3: -@@ -1618,3 +1722,3 @@ +@@ -1636,3 +1740,3 @@ 244 MONITOR_EXIT - ? THROW(Throwable) + 244 THROW(Throwable) diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala index 964594d258..4095d54e36 100644 --- a/test/files/run/inline-ex-handlers.scala +++ b/test/files/run/inline-ex-handlers.scala @@ -1,7 +1,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { - override def printIcodeAfterPhase = "inlinehandlers" + override def printIcodeAfterPhase = "inlinehandlers"; override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" // same line to minimize check file changs } import scala.util.Random._ diff --git a/test/files/run/large_class.check b/test/files/run/large_class.check index 0585c267ac..babe24db94 100644 --- a/test/files/run/large_class.check +++ b/test/files/run/large_class.check @@ -1,3 +1 @@ -newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Class file too large! -class BigEnoughToFail { - ^ +error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Class file too large! diff --git a/test/files/run/large_code.check b/test/files/run/large_code.check index 6ad50967bc..42bf490942 100644 --- a/test/files/run/large_code.check +++ b/test/files/run/large_code.check @@ -1,3 +1 @@ -newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Method tooLong's code too large! -class BigEnoughToFail { - ^ +error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Method tooLong's code too large! diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check index 66a0e707b3..c6457216b5 100644 --- a/test/files/run/t2106.check +++ b/test/files/run/t2106.check @@ -1,10 +1,10 @@ -#partest -Ybackend:GenBCode +#partest !-Ybackend:GenASM t2106.scala:7: warning: A::foo()Ljava/lang/Object; is annotated @inline but could not be inlined: The callee A::foo()Ljava/lang/Object; contains the instruction INVOKEVIRTUAL java/lang/Object.clone ()Ljava/lang/Object; that would cause an IllegalAccessError when inlined into class Test$. def main(args: Array[String]): Unit = x.foo ^ -#partest !-Ybackend:GenBCode +#partest -Ybackend:GenASM t2106.scala:7: warning: Could not inline required method foo because access level required by callee not matched by caller. def main(args: Array[String]): Unit = x.foo ^ diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala index 7f5af74c3f..24ed334816 100644 --- a/test/files/run/t5313.scala +++ b/test/files/run/t5313.scala @@ -3,7 +3,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" - override def extraSettings: String = super.extraSettings + " -optimize" + override def extraSettings: String = super.extraSettings + " -optimize -Ybackend:GenASM" override def code = """class Foo { diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check index 07378f5ed4..395864f57c 100644 --- a/test/files/run/t6102.check +++ b/test/files/run/t6102.check @@ -28,9 +28,9 @@ [running phase constopt on t6102.scala] #partest [running phase dce on t6102.scala] -#partest !-Ybackend:GenBCode +#partest -Ybackend:GenASM [running phase jvm on icode] -#partest -Ybackend:GenBCode +#partest !-Ybackend:GenASM [running phase jvm on t6102.scala] [running phase jvm on t6102.scala] #partest diff --git a/test/files/run/t6260c.check b/test/files/run/t6260c.check index 78e9b27371..1f17b1791b 100644 --- a/test/files/run/t6260c.check +++ b/test/files/run/t6260c.check @@ -1,8 +1,8 @@ f(C@2e) -#partest !-Ydelambdafy:method +#partest -Ydelambdafy:inline Test$$anonfun$$apply -#partest -Ydelambdafy:method +#partest !-Ydelambdafy:inline Test$lambda$1$$apply #partest apply diff --git a/test/files/run/t6288b-jump-position.check b/test/files/run/t6288b-jump-position.check deleted file mode 100644 index ece88b18f0..0000000000 --- a/test/files/run/t6288b-jump-position.check +++ /dev/null @@ -1,76 +0,0 @@ -object Case3 extends Object { - // fields: - - // methods - def unapply(z: Object (REF(class Object))): Option { - locals: value z - startBlock: 1 - blocks: [1] - - 1: - 2 NEW REF(class Some) - 2 DUP(REF(class Some)) - 2 CONSTANT(-1) - 2 BOX INT - 2 CALL_METHOD scala.Some.<init> (static-instance) - 2 RETURN(REF(class Option)) - - } - Exception handlers: - - def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, value x1, value x - startBlock: 1 - blocks: [1,2,3,6,7] - - 1: - 4 CONSTANT("") - 4 STORE_LOCAL(value x1) - 4 SCOPE_ENTER value x1 - 4 JUMP 2 - - 2: - 5 LOAD_LOCAL(value x1) - 5 IS_INSTANCE REF(class String) - 5 CZJUMP (BOOL)NE ? 3 : 6 - - 3: - 6 LOAD_MODULE object Predef - 6 CONSTANT("case 0") - 6 CALL_METHOD scala.Predef.println (dynamic) - 6 LOAD_FIELD scala.runtime.BoxedUnit.UNIT - 6 STORE_LOCAL(value x) - 6 JUMP 7 - - 6: - 8 LOAD_MODULE object Predef - 8 CONSTANT("default") - 8 CALL_METHOD scala.Predef.println (dynamic) - 8 LOAD_FIELD scala.runtime.BoxedUnit.UNIT - 8 STORE_LOCAL(value x) - 8 JUMP 7 - - 7: - 10 LOAD_MODULE object Predef - 10 CONSTANT("done") - 10 CALL_METHOD scala.Predef.println (dynamic) - 10 RETURN(UNIT) - - } - Exception handlers: - - def <init>(): Case3.type { - locals: - startBlock: 1 - blocks: [1] - - 1: - 12 THIS(Case3) - 12 CALL_METHOD java.lang.Object.<init> (super()) - 12 RETURN(UNIT) - - } - Exception handlers: - - -} diff --git a/test/files/run/t6288b-jump-position.scala b/test/files/run/t6288b-jump-position.scala deleted file mode 100644 index c5f3bbe788..0000000000 --- a/test/files/run/t6288b-jump-position.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.tools.partest.IcodeComparison - -object Test extends IcodeComparison { - override def code = - """object Case3 { // 01 - | def unapply(z: Any): Option[Int] = Some(-1) // 02 - | def main(args: Array[String]) { // 03 - | ("": Any) match { // 04 - | case x : String => // 05 Read: <linenumber> JUMP <target basic block id> - | println("case 0") // 06 expecting "6 JUMP 7", was "8 JUMP 7" - | case _ => // 07 - | println("default") // 08 expecting "8 JUMP 7" - | } // 09 - | println("done") // 10 - | } - |}""".stripMargin - - override def show() = showIcode() -} diff --git a/test/files/run/t6955.scala b/test/files/run/t6955.scala index 329af688e4..9ee3ef6bc5 100644 --- a/test/files/run/t6955.scala +++ b/test/files/run/t6955.scala @@ -21,6 +21,8 @@ class Switches { } object Test extends IcodeComparison { + override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" + // ensure we get two switches out of this -- ignore the rest of the output for robustness // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) override def show() = { diff --git a/test/files/run/t6956.scala b/test/files/run/t6956.scala index 3569adf483..594f5c9194 100644 --- a/test/files/run/t6956.scala +++ b/test/files/run/t6956.scala @@ -19,6 +19,8 @@ class Switches { } object Test extends IcodeComparison { + override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" + // ensure we get two switches out of this -- ignore the rest of the output for robustness // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) override def show() = { diff --git a/test/files/run/test-cpp.check b/test/files/run/test-cpp.check index 13f4c64be3..40c10e3350 100644 --- a/test/files/run/test-cpp.check +++ b/test/files/run/test-cpp.check @@ -1,11 +1,11 @@ --- a +++ b -@@ -36,3 +36,3 @@ +@@ -54,3 +54,3 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, value x, value y + locals: value args startBlock: 1 -@@ -41,10 +41,6 @@ +@@ -59,10 +59,6 @@ 1: - 52 CONSTANT(2) - 52 STORE_LOCAL(value x) @@ -17,12 +17,12 @@ - 54 LOAD_LOCAL(value y) + 54 CONSTANT(2) 54 BOX INT -@@ -91,3 +87,3 @@ +@@ -109,3 +105,3 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, value x, value y + locals: value args, value x startBlock: 1 -@@ -100,7 +96,5 @@ +@@ -118,7 +114,5 @@ 81 SCOPE_ENTER value x - 82 LOAD_LOCAL(value x) - 82 STORE_LOCAL(value y) @@ -31,12 +31,12 @@ - 83 LOAD_LOCAL(value y) + 83 LOAD_LOCAL(value x) 83 BOX INT -@@ -134,3 +128,3 @@ +@@ -152,3 +146,3 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, value x, value y + locals: value args startBlock: 1 -@@ -139,10 +133,6 @@ +@@ -157,10 +151,6 @@ 1: - 66 THIS(TestAliasChainDerefThis) - 66 STORE_LOCAL(value x) @@ -48,12 +48,12 @@ - 68 LOAD_LOCAL(value y) + 68 THIS(Object) 68 CALL_METHOD scala.Predef.println (dynamic) -@@ -175,3 +165,3 @@ +@@ -193,3 +183,3 @@ def test(x: Int (INT)): Unit { - locals: value x, value y + locals: value x startBlock: 1 -@@ -180,7 +170,5 @@ +@@ -198,7 +188,5 @@ 1: - 29 LOAD_LOCAL(value x) - 29 STORE_LOCAL(value y) @@ -62,7 +62,7 @@ - 30 LOAD_LOCAL(value y) + 30 LOAD_LOCAL(value x) 30 BOX INT -@@ -222,7 +210,5 @@ +@@ -240,7 +228,5 @@ 96 SCOPE_ENTER variable x - 97 LOAD_LOCAL(variable x) - 97 STORE_LOCAL(variable y) @@ -71,7 +71,7 @@ - 98 LOAD_LOCAL(variable y) + 98 LOAD_LOCAL(variable x) 98 BOX INT -@@ -232,6 +218,4 @@ +@@ -250,6 +236,4 @@ 100 STORE_LOCAL(variable y) - 101 LOAD_LOCAL(variable y) - 101 STORE_LOCAL(variable x) diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index 4e00e72658..7db831fb09 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -15,7 +15,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { - override def printIcodeAfterPhase = "dce" + override def printIcodeAfterPhase = "dce"; override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" // same line to minimize check file changs } import scala.util.Random._ diff --git a/test/junit/scala/issues/BytecodeTests.scala b/test/junit/scala/issues/BytecodeTests.scala index d4ed063a03..7c446894df 100644 --- a/test/junit/scala/issues/BytecodeTests.scala +++ b/test/junit/scala/issues/BytecodeTests.scala @@ -9,10 +9,17 @@ import scala.tools.nsc.backend.jvm.CodeGenTools._ import org.junit.Assert._ import scala.collection.JavaConverters._ import scala.tools.partest.ASMConverters._ +import scala.tools.testing.ClearAfterClass + +object BytecodeTests extends ClearAfterClass.Clearable { + var compiler = newCompiler() + def clear(): Unit = { compiler = null } +} @RunWith(classOf[JUnit4]) -class BytecodeTests { - val compiler = newCompiler() +class BytecodeTests extends ClearAfterClass { + ClearAfterClass.stateToClear = BytecodeTests + val compiler = BytecodeTests.compiler @Test def t8731(): Unit = { @@ -59,7 +66,6 @@ class BytecodeTests { |@AnnotB class B """.stripMargin - val compiler = newCompiler() val run = new compiler.Run() run.compileSources(List(new BatchSourceFile("AnnotA.java", annotA), new BatchSourceFile("AnnotB.java", annotB), new BatchSourceFile("Test.scala", scalaSrc))) val outDir = compiler.settings.outputDirs.getSingleOutput.get @@ -77,4 +83,55 @@ class BytecodeTests { // a @Retention annotation are currently emitted as RUNTIME. check("B.class", "AnnotB") } + + @Test + def t6288bJumpPosition(): Unit = { + val code = + """object Case3 { // 01 + | def unapply(z: Any): Option[Int] = Some(-1) // 02 + | def main(args: Array[String]) { // 03 + | ("": Any) match { // 04 + | case x : String => // 05 + | println("case 0") // 06 println and jump at 6 + | case _ => // 07 + | println("default") // 08 println and jump at 8 + | } // 09 + | println("done") // 10 + | } + |} + """.stripMargin + val List(mirror, module) = compileClasses(compiler)(code) + + val unapplyLineNumbers = getSingleMethod(module, "unapply").instructions.filter(_.isInstanceOf[LineNumber]) + assert(unapplyLineNumbers == List(LineNumber(2, Label(0))), unapplyLineNumbers) + + import Opcodes._ + val expected = List( + LineNumber(3, Label(0)), + LineNumber(4, Label(0)), + LineNumber(5, Label(5)), + Jump(IFNE, Label(11)), + Jump(GOTO, Label(20)), + + LineNumber(6, Label(11)), + Invoke(INVOKEVIRTUAL, "scala/Predef$", "println", "(Ljava/lang/Object;)V", false), + Jump(GOTO, Label(33)), + + LineNumber(5, Label(20)), + Jump(GOTO, Label(24)), + + LineNumber(8, Label(24)), + Invoke(INVOKEVIRTUAL, "scala/Predef$", "println", "(Ljava/lang/Object;)V", false), + Jump(GOTO, Label(33)), + + LineNumber(10, Label(33)), + Invoke(INVOKEVIRTUAL, "scala/Predef$", "println", "(Ljava/lang/Object;)V", false) + ) + + val mainIns = getSingleMethod(module, "main").instructions filter { + case _: LineNumber | _: Invoke | _: Jump => true + case _ => false + } + assertSameCode(mainIns, expected) + } } |