diff src/share/vm/ci/ciEnv.cpp @ 20574:9dc314de223d

8058828: Wrong ciConstant type for arrays from ConstantPool::_resolved_reference Reviewed-by: kvn, jrose
author vlivanov
date Wed, 01 Oct 2014 12:34:38 -0700
parents dd89808e49ba
children 7848fc12602b
line wrap: on
line diff
--- a/src/share/vm/ci/ciEnv.cpp	Wed Oct 01 12:34:45 2014 -0700
+++ b/src/share/vm/ci/ciEnv.cpp	Wed Oct 01 12:34:38 2014 -0700
@@ -559,7 +559,12 @@
     oop obj = cpool->resolved_references()->obj_at(cache_index);
     if (obj != NULL) {
       ciObject* ciobj = get_object(obj);
-      return ciConstant(T_OBJECT, ciobj);
+      if (ciobj->is_array()) {
+        return ciConstant(T_ARRAY, ciobj);
+      } else {
+        assert(ciobj->is_instance(), "should be an instance");
+        return ciConstant(T_OBJECT, ciobj);
+      }
     }
     index = cpool->object_to_cp_index(cache_index);
   }
@@ -586,8 +591,12 @@
       }
     }
     ciObject* constant = get_object(string);
-    assert (constant->is_instance(), "must be an instance, or not? ");
-    return ciConstant(T_OBJECT, constant);
+    if (constant->is_array()) {
+      return ciConstant(T_ARRAY, constant);
+    } else {
+      assert (constant->is_instance(), "must be an instance, or not? ");
+      return ciConstant(T_OBJECT, constant);
+    }
   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
     // 4881222: allow ldc to take a class type
     ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);