hotspot/src/share/vm/c1/c1_ValueType.cpp
changeset 31957 ed3e3cb35041
parent 13742 9180987e305d
child 37248 11a660dbbb8e
--- a/hotspot/src/share/vm/c1/c1_ValueType.cpp	Thu Jul 23 17:29:44 2015 +0100
+++ b/hotspot/src/share/vm/c1/c1_ValueType.cpp	Fri Jul 24 21:29:11 2015 -0400
@@ -153,7 +153,19 @@
     case T_FLOAT  : return new FloatConstant (value.as_float ());
     case T_DOUBLE : return new DoubleConstant(value.as_double());
     case T_ARRAY  : // fall through (ciConstant doesn't have an array accessor)
-    case T_OBJECT : return new ObjectConstant(value.as_object());
+    case T_OBJECT : {
+      // TODO: Common the code with GraphBuilder::load_constant?
+      ciObject* obj = value.as_object();
+      if (obj->is_null_object())
+        return objectNull;
+      if (obj->is_loaded()) {
+        if (obj->is_array())
+          return new ArrayConstant(obj->as_array());
+        else if (obj->is_instance())
+          return new InstanceConstant(obj->as_instance());
+      }
+      return new ObjectConstant(obj);
+    }
   }
   ShouldNotReachHere();
   return illegalType;