8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
authortwisti
Tue, 15 Jan 2013 12:06:18 -0800
changeset 15210 eb42543a7050
parent 15209 c30466e03ea1
child 15211 fea10e7a1f6b
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types Reviewed-by: kvn
hotspot/src/share/vm/ci/ciType.cpp
hotspot/src/share/vm/ci/ciType.hpp
hotspot/src/share/vm/opto/doCall.cpp
--- a/hotspot/src/share/vm/ci/ciType.cpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/hotspot/src/share/vm/ci/ciType.cpp	Tue Jan 15 12:06:18 2013 -0800
@@ -60,6 +60,19 @@
 }
 
 // ------------------------------------------------------------------
+// ciType::name
+//
+// Return the name of this type
+const char* ciType::name() {
+  if (is_primitive_type()) {
+    return type2name(basic_type());
+  } else {
+    assert(is_klass(), "must be");
+    return as_klass()->name()->as_utf8();
+  }
+}
+
+// ------------------------------------------------------------------
 // ciType::print_impl
 //
 // Implementation of the print method.
@@ -73,7 +86,8 @@
 //
 // Print the name of this type
 void ciType::print_name_on(outputStream* st) {
-  st->print(type2name(basic_type()));
+  ResourceMark rm;
+  st->print(name());
 }
 
 
--- a/hotspot/src/share/vm/ci/ciType.hpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/hotspot/src/share/vm/ci/ciType.hpp	Tue Jan 15 12:06:18 2013 -0800
@@ -77,6 +77,7 @@
   bool is_type() const                      { return true; }
   bool is_classless() const                 { return is_primitive_type(); }
 
+  const char* name();
   virtual void print_name_on(outputStream* st);
   void print_name() {
     print_name_on(tty);
--- a/hotspot/src/share/vm/opto/doCall.cpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Tue Jan 15 12:06:18 2013 -0800
@@ -553,7 +553,13 @@
         rtype = ctype;
       }
     } else {
-      assert(rtype == ctype, "mismatched return types");  // symbolic resolution enforces this
+      // Symbolic resolution enforces the types to be the same.
+      // NOTE: We must relax the assert for unloaded types because two
+      // different ciType instances of the same unloaded class type
+      // can appear to be "loaded" by different loaders (depending on
+      // the accessing class).
+      assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype,
+             err_msg_res("mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name()));
     }
 
     // If the return type of the method is not loaded, assert that the