changeset 4431:e34f4fe352e7

8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types Reviewed-by: kvn
author twisti
date Tue, 15 Jan 2013 12:06:18 -0800
parents c3a5ef31cb90
children 0a066b1dfe02
files src/share/vm/ci/ciType.cpp src/share/vm/ci/ciType.hpp src/share/vm/opto/doCall.cpp
diffstat 3 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/ci/ciType.cpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/src/share/vm/ci/ciType.cpp	Tue Jan 15 12:06:18 2013 -0800
@@ -64,6 +64,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.
@@ -77,7 +90,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/src/share/vm/ci/ciType.hpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/src/share/vm/ci/ciType.hpp	Tue Jan 15 12:06:18 2013 -0800
@@ -79,6 +79,7 @@
   bool is_type()                            { 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/src/share/vm/opto/doCall.cpp	Mon Jan 14 08:22:32 2013 -0800
+++ b/src/share/vm/opto/doCall.cpp	Tue Jan 15 12:06:18 2013 -0800
@@ -554,7 +554,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