diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-03-07 12:55:53 +0100 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-03-07 12:55:53 +0100 |
commit | 9f2e73b5acfcf1c7573dc822470e6b2623dbec3b (patch) | |
tree | 4c3076a02da9a73fe4ecb77a3850999c5356fb4c | |
parent | 3e4620c3b961c63d38fe5bedd095009e6c53102a (diff) | |
download | scala-9f2e73b5acfcf1c7573dc822470e6b2623dbec3b.tar.gz scala-9f2e73b5acfcf1c7573dc822470e6b2623dbec3b.tar.bz2 scala-9f2e73b5acfcf1c7573dc822470e6b2623dbec3b.zip |
there goes the pattern matching of CJUMP
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index f4b0c4cd66..67760e9aa9 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1457,45 +1457,42 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with jcode.emitGOTO_maybe_W(labels(whereto), false) // default to short jumps case CJUMP(success, failure, cond, kind) => - kind match { - case BOOL | BYTE | CHAR | SHORT | INT => // TODO Miguel says: if(kind.isIntSizedType) - if (nextBlock == success) { - jcode.emitIF_ICMP(conds(negate(cond)), labels(failure)) - // .. and fall through to success label - } else { - jcode.emitIF_ICMP(conds(cond), labels(success)) - if (nextBlock != failure) - jcode.emitGOTO_maybe_W(labels(failure), false) - } - - case REFERENCE(_) | ARRAY(_) => - if (nextBlock == success) { - jcode.emitIF_ACMP(conds(negate(cond)), labels(failure)) - // .. and fall through to success label - } else { - jcode.emitIF_ACMP(conds(cond), labels(success)) - if (nextBlock != failure) - jcode.emitGOTO_maybe_W(labels(failure), false) - } - - case _ => - (kind: @unchecked) match { - case LONG => jcode.emitLCMP() - case FLOAT => - if (cond == LT || cond == LE) jcode.emitFCMPG() - else jcode.emitFCMPL() - case DOUBLE => - if (cond == LT || cond == LE) jcode.emitDCMPG() - else jcode.emitDCMPL() - } - if (nextBlock == success) { - jcode.emitIF(conds(negate(cond)), labels(failure)) - // .. and fall through to success label - } else { - jcode.emitIF(conds(cond), labels(success)); - if (nextBlock != failure) - jcode.emitGOTO_maybe_W(labels(failure), false) - } + if(kind.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT + if (nextBlock == success) { + jcode.emitIF_ICMP(conds(negate(cond)), labels(failure)) + // .. and fall through to success label + } else { + jcode.emitIF_ICMP(conds(cond), labels(success)) + if (nextBlock != failure) + jcode.emitGOTO_maybe_W(labels(failure), false) + } + } else if(kind.isRefOrArrayType) { // REFERENCE(_) | ARRAY(_) + if (nextBlock == success) { + jcode.emitIF_ACMP(conds(negate(cond)), labels(failure)) + // .. and fall through to success label + } else { + jcode.emitIF_ACMP(conds(cond), labels(success)) + if (nextBlock != failure) + jcode.emitGOTO_maybe_W(labels(failure), false) + } + } else { + (kind: @unchecked) match { + case LONG => jcode.emitLCMP() + case FLOAT => + if (cond == LT || cond == LE) jcode.emitFCMPG() + else jcode.emitFCMPL() + case DOUBLE => + if (cond == LT || cond == LE) jcode.emitDCMPG() + else jcode.emitDCMPL() + } + if (nextBlock == success) { + jcode.emitIF(conds(negate(cond)), labels(failure)) + // .. and fall through to success label + } else { + jcode.emitIF(conds(cond), labels(success)); + if (nextBlock != failure) + jcode.emitGOTO_maybe_W(labels(failure), false) + } } case CZJUMP(success, failure, cond, kind) => |