hotspot/src/share/vm/c1/c1_Instruction.cpp
changeset 13728 882756847a04
parent 13487 75aa4880b15f
child 15476 5e4cda2ccd0b
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp	Fri Aug 31 16:39:35 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp	Sat Sep 01 13:25:18 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -396,6 +396,8 @@
     switch (type()->tag()) {
     case intTag:
       return HASH2(name(), type()->as_IntConstant()->value());
+    case addressTag:
+      return HASH2(name(), type()->as_AddressConstant()->value());
     case longTag:
       {
         jlong temp = type()->as_LongConstant()->value();
@@ -411,6 +413,11 @@
     case objectTag:
       assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values");
       return HASH2(name(), type()->as_ObjectType()->constant_value());
+    case metaDataTag:
+      assert(type()->as_MetadataType()->is_loaded(), "can't handle unloaded values");
+      return HASH2(name(), type()->as_MetadataType()->constant_value());
+    default:
+      ShouldNotReachHere();
     }
   }
   return 0;
@@ -456,6 +463,14 @@
                 t1->is_loaded() && t2->is_loaded() &&
                 t1->constant_value() == t2->constant_value());
       }
+    case metaDataTag:
+      {
+        MetadataType* t1 =    type()->as_MetadataType();
+        MetadataType* t2 = v->type()->as_MetadataType();
+        return (t1 != NULL && t2 != NULL &&
+                t1->is_loaded() && t2->is_loaded() &&
+                t1->constant_value() == t2->constant_value());
+      }
   }
   return false;
 }
@@ -508,6 +523,18 @@
     }
     break;
   }
+  case metaDataTag: {
+    ciMetadata* xvalue = lt->as_MetadataType()->constant_value();
+    ciMetadata* yvalue = rt->as_MetadataType()->constant_value();
+    assert(xvalue != NULL && yvalue != NULL, "not constants");
+    if (xvalue->is_loaded() && yvalue->is_loaded()) {
+      switch (cond) {
+      case If::eql: return xvalue == yvalue ? cond_true : cond_false;
+      case If::neq: return xvalue != yvalue ? cond_true : cond_false;
+      }
+    }
+    break;
+  }
   }
   return not_comparable;
 }