diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-08-06 21:32:56 +0200 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-08-06 21:32:56 +0200 |
commit | 7039f43a50169d2d5e4b178fe373f38578291243 (patch) | |
tree | e8af7a1d4fc76170b06ddd26ca3c612aa24b2553 /src/compiler | |
parent | b531f9577f5be47f99b0be0d6b9d586668e9ae69 (diff) | |
download | scala-7039f43a50169d2d5e4b178fe373f38578291243.tar.gz scala-7039f43a50169d2d5e4b178fe373f38578291243.tar.bz2 scala-7039f43a50169d2d5e4b178fe373f38578291243.zip |
SI-6102 avoid emitting illegal exception table range
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index a804cc92d3..7627edb79d 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -2565,6 +2565,19 @@ abstract class GenASM extends SubComponent with BytecodeWriters { case JUMP(whereto) => if (nextBlock != whereto) { jcode goTo labels(whereto) + } else if(m.exh.exists(eh => eh.covers(b))) { + // SI-6102: Determine whether eliding this JUMP results in an empty range being covered by some EH. + // If so, emit a NOP in place of the elided JUMP, to avoid "java.lang.ClassFormatError: Illegal exception table range" + val isSthgLeft = b.toList.exists { + case _: LOAD_EXCEPTION => false + case _: SCOPE_ENTER => false + case _: SCOPE_EXIT => false + case _: JUMP => false + case _ => true + } + if(!isSthgLeft) { + emit(asm.Opcodes.NOP) + } } case CJUMP(success, failure, cond, kind) => |