From bd0884151926b073884643951f462c4a3a05a2e7 Mon Sep 17 00:00:00 2001 From: twisti Date: Tue, 15 Jan 2013 12:06:18 -0800 Subject: [PATCH] 8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types Reviewed-by: kvn --- src/share/vm/ci/ciType.cpp | 16 +++++++++++++++- src/share/vm/ci/ciType.hpp | 1 + src/share/vm/opto/doCall.cpp | 8 +++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/share/vm/ci/ciType.cpp b/src/share/vm/ci/ciType.cpp index 47412130f..e74dd9218 100644 --- a/src/share/vm/ci/ciType.cpp +++ b/src/share/vm/ci/ciType.cpp @@ -59,6 +59,19 @@ bool ciType::is_subtype_of(ciType* type) { return false; } +// ------------------------------------------------------------------ +// 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 // @@ -73,7 +86,8 @@ void ciType::print_impl(outputStream* st) { // // Print the name of this type void ciType::print_name_on(outputStream* st) { - st->print(type2name(basic_type())); + ResourceMark rm; + st->print(name()); } diff --git a/src/share/vm/ci/ciType.hpp b/src/share/vm/ci/ciType.hpp index 807ae1bec..25f79e012 100644 --- a/src/share/vm/ci/ciType.hpp +++ b/src/share/vm/ci/ciType.hpp @@ -77,6 +77,7 @@ public: 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); diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp index 5d094c99a..9a7562d01 100644 --- a/src/share/vm/opto/doCall.cpp +++ b/src/share/vm/opto/doCall.cpp @@ -553,7 +553,13 @@ void Parse::do_call() { 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 -- GitLab