< prev index next >

src/hotspot/share/oops/klassVtable.cpp

Print this page




 483         // Do not check loader constraints for overpass methods because overpass
 484         // methods are created by the jvm to throw exceptions.
 485         if (checkconstraints && !target_method()->is_overpass()) {
 486           // Override vtable entry if passes loader constraint check
 487           // if loader constraint checking requested
 488           // No need to visit his super, since he and his super
 489           // have already made any needed loader constraints.
 490           // Since loader constraints are transitive, it is enough
 491           // to link to the first super, and we get all the others.
 492           Handle super_loader(THREAD, super_klass->class_loader());
 493 
 494           if (!oopDesc::equals(target_loader(), super_loader())) {
 495             ResourceMark rm(THREAD);
 496             Symbol* failed_type_symbol =
 497               SystemDictionary::check_signature_loaders(signature, target_loader,
 498                                                         super_loader, true,
 499                                                         CHECK_(false));
 500             if (failed_type_symbol != NULL) {
 501               stringStream ss;
 502               ss.print("loader constraint violation for class %s: when selecting "
 503                        "overriding method '", klass->external_name());
 504               target_method()->print_external_name(&ss),
 505               ss.print("' the class loader %s of the "
 506                        "selected method's type %s, and the class loader %s for its super "
 507                        "type %s have different Class objects for the type %s used in the signature (%s; %s)",


 508                        target_klass->class_loader_data()->loader_name_and_id(),
 509                        target_klass->external_name(),
 510                        super_klass->class_loader_data()->loader_name_and_id(),
 511                        super_klass->external_name(),
 512                        failed_type_symbol->as_klass_external_name(),
 513                        target_klass->class_in_module_of_loader(false, true),
 514                        super_klass->class_in_module_of_loader(false, true));
 515               THROW_MSG_(vmSymbols::java_lang_LinkageError(), ss.as_string(), false);
 516             }
 517           }
 518         }
 519 
 520         put_method_at(target_method(), i);
 521         overrides = true;
 522         if (!is_default) {
 523           target_method()->set_vtable_index(i);
 524         } else {
 525           if (def_vtable_indices != NULL) {
 526             if (is_preinitialized_vtable()) {
 527               // At runtime initialize_vtable is rerun as part of link_class_impl()


1210       if (!(target == NULL) && !target->is_public()) {
1211         // Stuff an IllegalAccessError throwing method in there instead.
1212         itableOffsetEntry::method_entry(_klass, method_table_offset)[m->itable_index()].
1213             initialize(Universe::throw_illegal_access_error());
1214       }
1215     } else {
1216       // Entry did resolve, check loader constraints before initializing
1217       // if checkconstraints requested
1218       if (checkconstraints) {
1219         Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
1220         if (!oopDesc::equals(method_holder_loader(), interface_loader())) {
1221           ResourceMark rm(THREAD);
1222           Symbol* failed_type_symbol =
1223             SystemDictionary::check_signature_loaders(m->signature(),
1224                                                       method_holder_loader,
1225                                                       interface_loader,
1226                                                       true, CHECK);
1227           if (failed_type_symbol != NULL) {
1228             stringStream ss;
1229             ss.print("loader constraint violation in interface itable"
1230                      " initialization for class %s: when selecting method '",
1231                      _klass->external_name());
1232             m->print_external_name(&ss),
1233             ss.print("' the class loader %s for super interface %s, and the class"
1234                      " loader %s of the selected method's %s, %s have"
1235                      " different Class objects for the type %s used in the signature (%s; %s)",


1236                      interf->class_loader_data()->loader_name_and_id(),
1237                      interf->external_name(),
1238                      target()->method_holder()->class_loader_data()->loader_name_and_id(),
1239                      target()->method_holder()->external_kind(),
1240                      target()->method_holder()->external_name(),
1241                      failed_type_symbol->as_klass_external_name(),
1242                      interf->class_in_module_of_loader(false, true),
1243                      target()->method_holder()->class_in_module_of_loader(false, true));
1244             THROW_MSG(vmSymbols::java_lang_LinkageError(), ss.as_string());
1245           }
1246         }
1247       }
1248 
1249       // ime may have moved during GC so recalculate address
1250       int ime_num = m->itable_index();
1251       assert(ime_num < ime_count, "oob");
1252       itableOffsetEntry::method_entry(_klass, method_table_offset)[ime_num].initialize(target());
1253       if (log_develop_is_enabled(Trace, itables)) {
1254         ResourceMark rm(THREAD);
1255         if (target() != NULL) {
1256           LogTarget(Trace, itables) lt;
1257           LogStream ls(lt);
1258           char* sig = target()->name_and_sig_as_C_string();
1259           ls.print("interface: %s, ime_num: %d, target: %s, method_holder: %s ",




 483         // Do not check loader constraints for overpass methods because overpass
 484         // methods are created by the jvm to throw exceptions.
 485         if (checkconstraints && !target_method()->is_overpass()) {
 486           // Override vtable entry if passes loader constraint check
 487           // if loader constraint checking requested
 488           // No need to visit his super, since he and his super
 489           // have already made any needed loader constraints.
 490           // Since loader constraints are transitive, it is enough
 491           // to link to the first super, and we get all the others.
 492           Handle super_loader(THREAD, super_klass->class_loader());
 493 
 494           if (!oopDesc::equals(target_loader(), super_loader())) {
 495             ResourceMark rm(THREAD);
 496             Symbol* failed_type_symbol =
 497               SystemDictionary::check_signature_loaders(signature, target_loader,
 498                                                         super_loader, true,
 499                                                         CHECK_(false));
 500             if (failed_type_symbol != NULL) {
 501               stringStream ss;
 502               ss.print("loader constraint violation for class %s: when selecting "
 503                        "overriding method %s the class loader %s of the "


 504                        "selected method's type %s, and the class loader %s for its super "
 505                        "type %s have different Class objects for the type %s used in the signature (%s; %s)",
 506                        klass->external_name(),
 507                        target_method()->name_and_sig_as_C_string(),
 508                        target_klass->class_loader_data()->loader_name_and_id(),
 509                        target_klass->external_name(),
 510                        super_klass->class_loader_data()->loader_name_and_id(),
 511                        super_klass->external_name(),
 512                        failed_type_symbol->as_klass_external_name(),
 513                        target_klass->class_in_module_of_loader(false, true),
 514                        super_klass->class_in_module_of_loader(false, true));
 515               THROW_MSG_(vmSymbols::java_lang_LinkageError(), ss.as_string(), false);
 516             }
 517           }
 518         }
 519 
 520         put_method_at(target_method(), i);
 521         overrides = true;
 522         if (!is_default) {
 523           target_method()->set_vtable_index(i);
 524         } else {
 525           if (def_vtable_indices != NULL) {
 526             if (is_preinitialized_vtable()) {
 527               // At runtime initialize_vtable is rerun as part of link_class_impl()


1210       if (!(target == NULL) && !target->is_public()) {
1211         // Stuff an IllegalAccessError throwing method in there instead.
1212         itableOffsetEntry::method_entry(_klass, method_table_offset)[m->itable_index()].
1213             initialize(Universe::throw_illegal_access_error());
1214       }
1215     } else {
1216       // Entry did resolve, check loader constraints before initializing
1217       // if checkconstraints requested
1218       if (checkconstraints) {
1219         Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
1220         if (!oopDesc::equals(method_holder_loader(), interface_loader())) {
1221           ResourceMark rm(THREAD);
1222           Symbol* failed_type_symbol =
1223             SystemDictionary::check_signature_loaders(m->signature(),
1224                                                       method_holder_loader,
1225                                                       interface_loader,
1226                                                       true, CHECK);
1227           if (failed_type_symbol != NULL) {
1228             stringStream ss;
1229             ss.print("loader constraint violation in interface itable"
1230                      " initialization for class %s: when selecting method %s the"
1231                      " class loader %s for super interface %s, and the class"
1232                      " loader %s of the selected method's type, %s have"


1233                      " different Class objects for the type %s used in the signature (%s; %s)",
1234                      _klass->external_name(),
1235                      m->name_and_sig_as_C_string(),
1236                      interf->class_loader_data()->loader_name_and_id(),
1237                      interf->external_name(),
1238                      target()->method_holder()->class_loader_data()->loader_name_and_id(),

1239                      target()->method_holder()->external_name(),
1240                      failed_type_symbol->as_klass_external_name(),
1241                      interf->class_in_module_of_loader(false, true),
1242                      target()->method_holder()->class_in_module_of_loader(false, true));
1243             THROW_MSG(vmSymbols::java_lang_LinkageError(), ss.as_string());
1244           }
1245         }
1246       }
1247 
1248       // ime may have moved during GC so recalculate address
1249       int ime_num = m->itable_index();
1250       assert(ime_num < ime_count, "oob");
1251       itableOffsetEntry::method_entry(_klass, method_table_offset)[ime_num].initialize(target());
1252       if (log_develop_is_enabled(Trace, itables)) {
1253         ResourceMark rm(THREAD);
1254         if (target() != NULL) {
1255           LogTarget(Trace, itables) lt;
1256           LogStream ls(lt);
1257           char* sig = target()->name_and_sig_as_C_string();
1258           ls.print("interface: %s, ime_num: %d, target: %s, method_holder: %s ",


< prev index next >