diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/ICodes.scala | 19 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala | 7 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala index 9553d5cf9b..06c3ee2a9e 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala @@ -35,7 +35,7 @@ abstract class ICodes extends AnyRef with Repository { val global: Global - import global.{ definitions, settings, perRunCaches } + import global.{ log, definitions, settings, perRunCaches } /** The ICode representation of classes */ val classes = perRunCaches.newMap[global.Symbol, IClass]() @@ -72,11 +72,22 @@ abstract class ICodes extends AnyRef } def checkValid(m: IMethod) { - for (b <- m.code.blocks) - if (!b.closed) { + // always dicey to iterate over mutable structures + val bs = m.code.blocks.toList + + for (b <- bs ; if !b.closed) { + // Something is leaving open/empty blocks around (see SI-4840) so + // let's not kill the deal unless it's nonempty. + if (b.isEmpty) { + log("!!! Found open but empty block while inlining " + m + ": removing from block list.") + m.code removeBlock b + } + else { + Console.println("Fatal bug in inliner: found open block when inlining " + m) m.dump - global.abort("Open block: " + b + " " + b.flagsString) + global.abort("Open block was: " + b + " " + b.flagsString) } + } } object liveness extends Liveness { diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index 9f22a6de90..8130c99978 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -14,6 +14,8 @@ import mutable.ListBuffer trait Linearizers { self: ICodes => + + import global.debuglog import opcodes._ abstract class Linearizer { @@ -178,11 +180,14 @@ trait Linearizers { * Prepend b to the list, if not already scheduled. * @return Returns true if the block was added. */ - def add(b: BasicBlock) = + def add(b: BasicBlock) = { + debuglog("Linearizer adding block " + b.label) + if (!added(b.label)) { added += b.label blocks = b :: blocks; } + } } /** A 'dump' of the blocks in this method, which does not |