summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-12-01 08:28:07 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-12-01 08:28:07 +0000
commit0f17201b1005b85a8bbfd6be668fd9ffcc782375 (patch)
treef887faae4290d56e1868f81885b2c239d1ffdd54 /src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
parent43c13143331d00ea78369ce41caa29e46752a69d (diff)
downloadscala-0f17201b1005b85a8bbfd6be668fd9ffcc782375.tar.gz
scala-0f17201b1005b85a8bbfd6be668fd9ffcc782375.tar.bz2
scala-0f17201b1005b85a8bbfd6be668fd9ffcc782375.zip
fix msil code generation for exception handlers.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index b708d4df80..30060cc9eb 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -460,6 +460,23 @@ trait BasicBlocks {
succs
}
+ def directSuccessors: List[BasicBlock] = {
+ if (isEmpty) Nil else lastInstruction match {
+ case JUMP(whereto) => List(whereto)
+ case CJUMP(success, failure, _, _) => failure :: success :: Nil
+ case CZJUMP(success, failure, _, _) => failure :: success :: Nil
+ case SWITCH(_, labels) => labels
+ case RETURN(_) => Nil
+ case THROW() => Nil
+ case _ =>
+ if (closed) {
+ dump
+ global.abort("The last instruction is not a control flow instruction: " + lastInstruction)
+ }
+ else Nil
+ }
+ }
+
/** Return a list of successors for 'b' that come from exception handlers
* covering b's (non-exceptional) successors. These exception handlers
* might not cover 'b' itself. This situation corresponds to an