summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Garcia <miguelalfredo.garcia@epfl.ch>2012-03-07 13:00:06 +0100
committerMiguel Garcia <miguelalfredo.garcia@epfl.ch>2012-03-07 13:00:06 +0100
commit428aee0fde48f98c1044c37c10b76c90c09b4f99 (patch)
treee0d93709583e400acd9c2f25aa1df1778a0c599a /src
parent9f2e73b5acfcf1c7573dc822470e6b2623dbec3b (diff)
downloadscala-428aee0fde48f98c1044c37c10b76c90c09b4f99.tar.gz
scala-428aee0fde48f98c1044c37c10b76c90c09b4f99.tar.bz2
scala-428aee0fde48f98c1044c37c10b76c90c09b4f99.zip
mechanically applying the above recipe
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala94
1 files changed, 44 insertions, 50 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 67760e9aa9..336a8b5f76 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -1496,56 +1496,50 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
}
case CZJUMP(success, failure, cond, kind) =>
- kind match {
- case BOOL | BYTE | CHAR | SHORT | INT => // TODO Miguel says: if(kind.isIntSizedType)
- if (nextBlock == success) {
- jcode.emitIF(conds(negate(cond)), labels(failure))
- } else {
- jcode.emitIF(conds(cond), labels(success))
- if (nextBlock != failure)
- jcode.emitGOTO_maybe_W(labels(failure), false)
- }
-
- case REFERENCE(_) | ARRAY(_) =>
- val Success = success
- val Failure = failure
- (cond, nextBlock) match {
- case (EQ, Success) =>
- jcode emitIFNONNULL labels(failure)
- case (NE, Failure) =>
- jcode emitIFNONNULL labels(success)
- case (EQ, Failure) =>
- jcode emitIFNULL labels(success)
- case (NE, Success) =>
- jcode emitIFNULL labels(failure)
- case (EQ, _) =>
- jcode emitIFNULL labels(success)
- jcode.emitGOTO_maybe_W(labels(failure), false)
- case (NE, _) =>
- jcode emitIFNONNULL labels(success)
- jcode.emitGOTO_maybe_W(labels(failure), false)
- }
-
- case _ =>
- (kind: @unchecked) match {
- case LONG =>
- jcode.emitLCONST_0(); jcode.emitLCMP()
- case FLOAT =>
- jcode.emitFCONST_0()
- if (cond == LT || cond == LE) jcode.emitFCMPG()
- else jcode.emitFCMPL()
- case DOUBLE =>
- jcode.emitDCONST_0()
- if (cond == LT || cond == LE) jcode.emitDCMPG()
- else jcode.emitDCMPL()
- }
- if (nextBlock == success) {
- jcode.emitIF(conds(negate(cond)), labels(failure))
- } 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(conds(negate(cond)), labels(failure))
+ } else {
+ jcode.emitIF(conds(cond), labels(success))
+ if (nextBlock != failure)
+ jcode.emitGOTO_maybe_W(labels(failure), false)
+ }
+ } else if(kind.isRefOrArrayType) { // REFERENCE(_) | ARRAY(_)
+ val Success = success
+ val Failure = failure
+ (cond, nextBlock) match {
+ case (EQ, Success) => jcode emitIFNONNULL labels(failure)
+ case (NE, Failure) => jcode emitIFNONNULL labels(success)
+ case (EQ, Failure) => jcode emitIFNULL labels(success)
+ case (NE, Success) => jcode emitIFNULL labels(failure)
+ case (EQ, _) =>
+ jcode emitIFNULL labels(success)
+ jcode.emitGOTO_maybe_W(labels(failure), false)
+ case (NE, _) =>
+ jcode emitIFNONNULL labels(success)
+ jcode.emitGOTO_maybe_W(labels(failure), false)
+ }
+ } else {
+ (kind: @unchecked) match {
+ case LONG =>
+ jcode.emitLCONST_0()
+ jcode.emitLCMP()
+ case FLOAT =>
+ jcode.emitFCONST_0()
+ if (cond == LT || cond == LE) jcode.emitFCMPG()
+ else jcode.emitFCMPL()
+ case DOUBLE =>
+ jcode.emitDCONST_0()
+ if (cond == LT || cond == LE) jcode.emitDCMPG()
+ else jcode.emitDCMPL()
+ }
+ if (nextBlock == success) {
+ jcode.emitIF(conds(negate(cond)), labels(failure))
+ } else {
+ jcode.emitIF(conds(cond), labels(success))
+ if (nextBlock != failure)
+ jcode.emitGOTO_maybe_W(labels(failure), false)
+ }
}
case RETURN(kind) =>