src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6817525 Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.cpp

Print this page




1665 
1666 char* SharedRuntime::generate_class_cast_message(
1667     JavaThread* thread, const char* objName) {
1668 
1669   // Get target class name from the checkcast instruction
1670   vframeStream vfst(thread, true);
1671   assert(!vfst.at_end(), "Java frame must exist");
1672   Bytecode_checkcast cc(vfst.method(), vfst.method()->bcp_from(vfst.bci()));
1673   Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
1674     cc.index(), thread));
1675   return generate_class_cast_message(objName, targetKlass->external_name());
1676 }
1677 
1678 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
1679                                                         oopDesc* required,
1680                                                         oopDesc* actual) {
1681   if (TraceMethodHandles) {
1682     tty->print_cr("WrongMethodType thread="PTR_FORMAT" req="PTR_FORMAT" act="PTR_FORMAT"",
1683                   thread, required, actual);
1684   }
1685   assert(EnableMethodHandles, "");
1686   oop singleKlass = wrong_method_type_is_for_single_argument(thread, required);
1687   char* message = NULL;
1688   if (singleKlass != NULL) {
1689     const char* objName = "argument or return value";
1690     if (actual != NULL) {
1691       // be flexible about the junk passed in:
1692       klassOop ak = (actual->is_klass()
1693                      ? (klassOop)actual
1694                      : actual->klass());
1695       objName = Klass::cast(ak)->external_name();
1696     }
1697     Klass* targetKlass = Klass::cast(required->is_klass()
1698                                      ? (klassOop)required
1699                                      : java_lang_Class::as_klassOop(required));
1700     message = generate_class_cast_message(objName, targetKlass->external_name());
1701   } else {
1702     // %%% need to get the MethodType string, without messing around too much
1703     // Get a signature from the invoke instruction
1704     const char* mhName = "method handle";
1705     const char* targetType = "the required signature";




1665 
1666 char* SharedRuntime::generate_class_cast_message(
1667     JavaThread* thread, const char* objName) {
1668 
1669   // Get target class name from the checkcast instruction
1670   vframeStream vfst(thread, true);
1671   assert(!vfst.at_end(), "Java frame must exist");
1672   Bytecode_checkcast cc(vfst.method(), vfst.method()->bcp_from(vfst.bci()));
1673   Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
1674     cc.index(), thread));
1675   return generate_class_cast_message(objName, targetKlass->external_name());
1676 }
1677 
1678 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
1679                                                         oopDesc* required,
1680                                                         oopDesc* actual) {
1681   if (TraceMethodHandles) {
1682     tty->print_cr("WrongMethodType thread="PTR_FORMAT" req="PTR_FORMAT" act="PTR_FORMAT"",
1683                   thread, required, actual);
1684   }
1685   assert(EnableInvokeDynamic, "");
1686   oop singleKlass = wrong_method_type_is_for_single_argument(thread, required);
1687   char* message = NULL;
1688   if (singleKlass != NULL) {
1689     const char* objName = "argument or return value";
1690     if (actual != NULL) {
1691       // be flexible about the junk passed in:
1692       klassOop ak = (actual->is_klass()
1693                      ? (klassOop)actual
1694                      : actual->klass());
1695       objName = Klass::cast(ak)->external_name();
1696     }
1697     Klass* targetKlass = Klass::cast(required->is_klass()
1698                                      ? (klassOop)required
1699                                      : java_lang_Class::as_klassOop(required));
1700     message = generate_class_cast_message(objName, targetKlass->external_name());
1701   } else {
1702     // %%% need to get the MethodType string, without messing around too much
1703     // Get a signature from the invoke instruction
1704     const char* mhName = "method handle";
1705     const char* targetType = "the required signature";


src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File