diff --git a/src/share/vm/ci/ciType.cpp b/src/share/vm/ci/ciType.cpp index 47412130f04d4b1b76ef2eda8d35e9b3c582efed..e74dd921804d9e9d6aefc36ad881bda942c0617f 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 807ae1bec9269cffa1e6a970cf8601c71ede7871..25f79e0126357d9df598760bb74a4b0ef34e95f0 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 5d094c99afcb36a021dd92d3f4adbe9d9bb081d1..9a7562d01fb5a49c157d50bde43f46a856a81e13 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