summaryrefslogtreecommitdiff
path: root/sources/scalac/backend
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2005-04-11 14:57:26 +0000
committerpaltherr <paltherr@epfl.ch>2005-04-11 14:57:26 +0000
commitfa99242159242f676b6b234693060d422762cebd (patch)
tree5fba57d3868cdc28176353ac2b0b943df44e5e11 /sources/scalac/backend
parentfd4e74823ef61bdd8cd8eaffff03e62f6becd087 (diff)
downloadscala-fa99242159242f676b6b234693060d422762cebd.tar.gz
scala-fa99242159242f676b6b234693060d422762cebd.tar.bz2
scala-fa99242159242f676b6b234693060d422762cebd.zip
- Added method "ne" in class AnyRef
Diffstat (limited to 'sources/scalac/backend')
-rw-r--r--sources/scalac/backend/Primitive.java1
-rw-r--r--sources/scalac/backend/Primitives.java1
-rw-r--r--sources/scalac/backend/jvm/GenJVM.java11
-rw-r--r--sources/scalac/backend/msil/GenMSIL.java4
4 files changed, 11 insertions, 6 deletions
diff --git a/sources/scalac/backend/Primitive.java b/sources/scalac/backend/Primitive.java
index 5cc6f49106..2c55a68dc8 100644
--- a/sources/scalac/backend/Primitive.java
+++ b/sources/scalac/backend/Primitive.java
@@ -47,6 +47,7 @@ public class Primitive {
// Comparison operations
public case ID; // x eq y
+ public case NI; // x ne y
public case EQ; // x == y
public case NE; // x != y
public case LT; // x < y
diff --git a/sources/scalac/backend/Primitives.java b/sources/scalac/backend/Primitives.java
index 76869c2f78..b2cef185dd 100644
--- a/sources/scalac/backend/Primitives.java
+++ b/sources/scalac/backend/Primitives.java
@@ -668,6 +668,7 @@ public class Primitives {
// scala.Object
addPrimitive(defs.OBJECT_EQ, Primitive.ID);
+ addPrimitive(defs.OBJECT_NE, Primitive.NI);
addPrimitive(defs.OBJECT_SYNCHRONIZED, Primitive.SYNCHRONIZED);
// scala.String
diff --git a/sources/scalac/backend/jvm/GenJVM.java b/sources/scalac/backend/jvm/GenJVM.java
index 9ba9b67939..037b66b423 100644
--- a/sources/scalac/backend/jvm/GenJVM.java
+++ b/sources/scalac/backend/jvm/GenJVM.java
@@ -348,7 +348,7 @@ public class GenJVM {
generatedType = resType;
break;
- case ID:
+ case ID: case NI:
case EQ: case NE: case LT: case LE: case GE: case GT:
case ZNOT: case ZOR: case ZAND:
JCode.Label falseLabel = ctx.code.newLabel();
@@ -711,7 +711,7 @@ public class GenJVM {
Tree[] allArgs = extractPrimitiveArgs((Tree.Apply)tree);
switch (prim) {
- case ID: case EQ: case NE:
+ case ID: case NI: case EQ: case NE:
assert allArgs.length == 2;
Tree unbox1 = unbox(allArgs[0]);
Tree unbox2 = unbox(allArgs[1]);
@@ -864,6 +864,9 @@ public class GenJVM {
if (prim == Primitive.ID) {
if (when) ctx.code.emitIF_ACMPEQ(target);
else ctx.code.emitIF_ACMPNE(target);
+ } else if (prim == Primitive.NI) {
+ if (!when) ctx.code.emitIF_ACMPEQ(target);
+ else ctx.code.emitIF_ACMPNE(target);
} else {
// Comparison between two references. We inline the code
// for the predefined (and final) "=="/"!=" operators,
@@ -1193,7 +1196,7 @@ public class GenJVM {
protected boolean isJumpingPrimitive(Symbol sym) {
if (prims.isPrimitive(sym)) {
switch (prims.getPrimitive(sym)) {
- case ID : case EQ : case NE :
+ case ID : case NI : case EQ : case NE :
case LT : case LE : case GE : case GT :
case ZNOT : case ZOR : case ZAND :
return true;
@@ -1228,7 +1231,7 @@ public class GenJVM {
case ZARRAY_LENGTH : case BARRAY_LENGTH : case SARRAY_LENGTH :
case CARRAY_LENGTH : case IARRAY_LENGTH : case LARRAY_LENGTH :
case FARRAY_LENGTH : case DARRAY_LENGTH : case OARRAY_LENGTH :
- case IS : case AS : case ID :
+ case IS : case AS : case ID : case NI :
case CONCAT : case THROW : case SYNCHRONIZED:
case B2B: case B2S: case B2C: case B2I: case B2L: case B2F: case B2D:
case S2B: case S2S: case S2C: case S2I: case S2L: case S2F: case S2D:
diff --git a/sources/scalac/backend/msil/GenMSIL.java b/sources/scalac/backend/msil/GenMSIL.java
index eae9c7cf4a..ec490359d9 100644
--- a/sources/scalac/backend/msil/GenMSIL.java
+++ b/sources/scalac/backend/msil/GenMSIL.java
@@ -1011,7 +1011,7 @@ public final class GenMSIL {
case ADD: case SUB: case MUL: case DIV: case MOD:
case OR: case XOR: case AND:
case LSL: case LSR: case ASR:
- case ID: case EQ: case NE: case LT: case LE: case GT: case GE:
+ case ID: case NI: case EQ: case NE: case LT: case LE: case GT: case GE:
case ZNOT: case ZOR: case ZAND:
case IS: case AS:
case CONCAT:
@@ -1246,7 +1246,7 @@ public final class GenMSIL {
case ID: case EQ: // FIXME?: should ID be treated as EQ?
res = items.CondItem(Test.Binary(Test.EQ, toType), null, null);
break;
- case NE:
+ case NI: case NE: // FIXME?: should NI be treated as NE?
res = items.CondItem(Test.Binary(Test.NE, toType), null, null);
break;
case LT: