131 // assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile"); |
131 // assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile"); |
132 if (THREAD->is_Compiler_thread()) { |
132 if (THREAD->is_Compiler_thread()) { |
133 // don't force compilation, resolve was on behalf of compiler |
133 // don't force compilation, resolve was on behalf of compiler |
134 return; |
134 return; |
135 } |
135 } |
136 if (InstanceKlass::cast(selected_method->method_holder())->is_not_initialized()) { |
136 if (selected_method->method_holder()->is_not_initialized()) { |
137 // 'is_not_initialized' means not only '!is_initialized', but also that |
137 // 'is_not_initialized' means not only '!is_initialized', but also that |
138 // initialization has not been started yet ('!being_initialized') |
138 // initialization has not been started yet ('!being_initialized') |
139 // Do not force compilation of methods in uninitialized classes. |
139 // Do not force compilation of methods in uninitialized classes. |
140 // Note that doing this would throw an assert later, |
140 // Note that doing this would throw an assert later, |
141 // in CompileBroker::compile_method. |
141 // in CompileBroker::compile_method. |
464 resolved_method, |
464 resolved_method, |
465 CHECK); |
465 CHECK); |
466 |
466 |
467 // check loader constraints |
467 // check loader constraints |
468 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); |
468 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); |
469 Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); |
469 Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); |
470 { |
470 { |
471 ResourceMark rm(THREAD); |
471 ResourceMark rm(THREAD); |
472 char* failed_type_name = |
472 char* failed_type_name = |
473 SystemDictionary::check_signature_loaders(method_signature, loader, |
473 SystemDictionary::check_signature_loaders(method_signature, loader, |
474 class_loader, true, CHECK); |
474 class_loader, true, CHECK); |
526 } |
526 } |
527 |
527 |
528 if (check_access) { |
528 if (check_access) { |
529 HandleMark hm(THREAD); |
529 HandleMark hm(THREAD); |
530 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); |
530 Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader()); |
531 Handle class_loader (THREAD, InstanceKlass::cast(resolved_method->method_holder())->class_loader()); |
531 Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); |
532 { |
532 { |
533 ResourceMark rm(THREAD); |
533 ResourceMark rm(THREAD); |
534 char* failed_type_name = |
534 char* failed_type_name = |
535 SystemDictionary::check_signature_loaders(method_signature, loader, |
535 SystemDictionary::check_signature_loaders(method_signature, loader, |
536 class_loader, true, CHECK); |
536 class_loader, true, CHECK); |
908 THROW(vmSymbols::java_lang_NullPointerException()); |
908 THROW(vmSymbols::java_lang_NullPointerException()); |
909 } |
909 } |
910 |
910 |
911 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
911 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
912 // has not been rewritten, and the vtable initialized. |
912 // has not been rewritten, and the vtable initialized. |
913 assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); |
913 assert(resolved_method->method_holder()->is_linked(), "must be linked"); |
914 |
914 |
915 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
915 // Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
916 // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since |
916 // has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since |
917 // a missing receiver might result in a bogus lookup. |
917 // a missing receiver might result in a bogus lookup. |
918 assert(InstanceKlass::cast(resolved_method->method_holder())->is_linked(), "must be linked"); |
918 assert(resolved_method->method_holder()->is_linked(), "must be linked"); |
919 |
919 |
920 // do lookup based on receiver klass using the vtable index |
920 // do lookup based on receiver klass using the vtable index |
921 if (resolved_method->method_holder()->is_interface()) { // miranda method |
921 if (resolved_method->method_holder()->is_interface()) { // miranda method |
922 vtable_index = vtable_index_of_miranda_method(resolved_klass, |
922 vtable_index = vtable_index_of_miranda_method(resolved_klass, |
923 resolved_method->name(), |
923 resolved_method->name(), |