summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-05-19 06:56:51 -0700
committerPaul Phillips <paulp@improving.org>2013-05-19 06:56:51 -0700
commit16e92f48e7b075d8addf037953b5696a497258c6 (patch)
tree237347c0d9da18a4d9e151a9928453b2d347c613
parent01dec25425cefb6acc147d8341893eb70ca76245 (diff)
parent3fb317560c7e1220cd51c7f8408cf3db6a84b290 (diff)
downloadscala-16e92f48e7b075d8addf037953b5696a497258c6.tar.gz
scala-16e92f48e7b075d8addf037953b5696a497258c6.tar.bz2
scala-16e92f48e7b075d8addf037953b5696a497258c6.zip
Merge pull request #2565 from paulp/issue/7427
SI-7427 stop crashing under -Ydebug.
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala33
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala3
-rw-r--r--test/files/pos/t7427.flags1
-rw-r--r--test/files/pos/t7427.scala4
4 files changed, 22 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index 16ee40280c..26d10d2514 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -8,8 +8,7 @@ package backend
package icode
import scala.collection.{ mutable, immutable }
-import mutable.{ ListBuffer, ArrayBuffer }
-import scala.reflect.internal.util.{ Position, NoPosition }
+import mutable.ListBuffer
import backend.icode.analysis.ProgramPoint
import scala.language.postfixOps
@@ -17,8 +16,7 @@ trait BasicBlocks {
self: ICodes =>
import opcodes._
- import global.{ settings, debuglog, log, nme }
- import nme.isExceptionResultName
+ import global._
/** Override Array creation for efficiency (to not go through reflection). */
private implicit val instructionTag: scala.reflect.ClassTag[Instruction] = new scala.reflect.ClassTag[Instruction] {
@@ -336,9 +334,9 @@ trait BasicBlocks {
* put into ignore mode so we hear about it if there's a problem.
*/
instr match {
- case JUMP(_) | RETURN(_) | THROW(_) | SCOPE_EXIT(_) => // ok
- case STORE_LOCAL(local) if isExceptionResultName(local.sym.name) => // ok
- case x => log("Ignoring instruction, possibly at our peril, at " + pos + ": " + x)
+ case JUMP(_) | RETURN(_) | THROW(_) | SCOPE_EXIT(_) => // ok
+ case STORE_LOCAL(local) if nme.isExceptionResultName(local.sym.name) => // ok
+ case x => log("Ignoring instruction, possibly at our peril, at " + pos + ": " + x)
}
}
}
@@ -416,7 +414,7 @@ trait BasicBlocks {
enterIgnoreMode()
}
}
-
+
/**
* Same as killIf but with the logic of the condition reversed
*/
@@ -477,16 +475,17 @@ trait BasicBlocks {
def directSuccessors: List[BasicBlock] =
if (isEmpty) Nil else lastInstruction match {
- case JUMP(whereto) => whereto :: Nil
- case CJUMP(succ, fail, _, _) => fail :: succ :: Nil
- case CZJUMP(succ, fail, _, _) => fail :: succ :: Nil
- case SWITCH(_, labels) => labels
- case RETURN(_) => Nil
- case THROW(_) => Nil
- case _ =>
+ case JUMP(whereto) => whereto :: Nil
+ case CJUMP(succ, fail, _, _) => fail :: succ :: Nil
+ case CZJUMP(succ, fail, _, _) => fail :: succ :: Nil
+ case SWITCH(_, labels) => labels
+ case RETURN(_) => Nil
+ case THROW(_) => Nil
+ case _ =>
if (closed)
- dumpClassesAndAbort("The last instruction is not a control flow instruction: " + lastInstruction)
- else Nil
+ devWarning(s"$lastInstruction/${lastInstruction.getClass.getName} is not a control flow instruction")
+
+ Nil
}
/** Returns the predecessors of this block. */
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 9c9c001f02..cc4d97253f 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -2165,8 +2165,7 @@ abstract class GenICode extends SubComponent {
* by a real JUMP instruction when all labels are resolved.
*/
abstract class PseudoJUMP(label: Label) extends Instruction {
- override def toString(): String = "PJUMP " + label.symbol
-
+ override def toString = s"PJUMP(${label.symbol})"
override def consumed = 0
override def produced = 0
diff --git a/test/files/pos/t7427.flags b/test/files/pos/t7427.flags
new file mode 100644
index 0000000000..9c7d6400fc
--- /dev/null
+++ b/test/files/pos/t7427.flags
@@ -0,0 +1 @@
+-Ydebug
diff --git a/test/files/pos/t7427.scala b/test/files/pos/t7427.scala
new file mode 100644
index 0000000000..cca52950d1
--- /dev/null
+++ b/test/files/pos/t7427.scala
@@ -0,0 +1,4 @@
+// Compiles with no options
+// Compiles with -Ydebug -Ydisable-unreachable-prevention
+// Crashes with -Ydebug
+trait Bippy { 3 match { case 3 => } }