summaryrefslogtreecommitdiff
path: root/sources/scalac/backend
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2003-08-12 09:29:19 +0000
committerschinz <schinz@epfl.ch>2003-08-12 09:29:19 +0000
commit7cd27574a602d8530292bdc251746745a644ce7e (patch)
tree4bd4833d8c4ec733811f27df3327f9fc722a2c2d /sources/scalac/backend
parentd61afba2c59980d86f53d2597be3be6305ab9865 (diff)
downloadscala-7cd27574a602d8530292bdc251746745a644ce7e.tar.gz
scala-7cd27574a602d8530292bdc251746745a644ce7e.tar.bz2
scala-7cd27574a602d8530292bdc251746745a644ce7e.zip
- implemented referential equality (x eq y)
Diffstat (limited to 'sources/scalac/backend')
-rw-r--r--sources/scalac/backend/jvm/GenJVM.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/sources/scalac/backend/jvm/GenJVM.java b/sources/scalac/backend/jvm/GenJVM.java
index 6ad94214d1..3937fa2a7f 100644
--- a/sources/scalac/backend/jvm/GenJVM.java
+++ b/sources/scalac/backend/jvm/GenJVM.java
@@ -306,6 +306,7 @@ class GenJVM {
generatedType = resType;
break;
+ case ID:
case EQ: case NE: case LT: case LE: case GE: case GT:
case ZNOT: case ZOR: case ZAND:
JLabel falseLabel = new JLabel();
@@ -654,7 +655,7 @@ class GenJVM {
Tree[] allArgs = extractPrimitiveArgs((Tree.Apply)tree);
switch (prim) {
- case EQ: case NE: case LT: case LE: case GE: case GT:
+ case ID: case EQ: case NE: case LT: case LE: case GE: case GT:
assert allArgs.length == 2;
genCompPrim(ctx, prim, allArgs, target, when);
return;
@@ -807,7 +808,10 @@ class GenJVM {
intCompareWithZero |= isIntZero;
}
- if (maxType.isReferenceType()) {
+ if (prim == Primitive.ID) {
+ if (when) ctx.code.emitIF_ACMPEQ(target);
+ else ctx.code.emitIF_ACMPNE(target);
+ } else if (maxType.isReferenceType()) {
// Comparison between two references. We inline the code
// for the predefined (and final) "=="/"!=" operators,
// which check for null values and then forward the call
@@ -1054,7 +1058,7 @@ 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 IS : case AS : case ID :
case CONCAT :
case THROW :
case AS_UVALUE :