hotspot/src/share/vm/interpreter/linkResolver.cpp
changeset 33611 9abd65805e19
parent 33602 16053580a684
child 34229 892795cc82fe
equal deleted inserted replaced
33602:16053580a684 33611:9abd65805e19
   300   Symbol* signature = link_info.signature();
   300   Symbol* signature = link_info.signature();
   301 
   301 
   302   // Ignore overpasses so statics can be found during resolution
   302   // Ignore overpasses so statics can be found during resolution
   303   Method* result = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);
   303   Method* result = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);
   304 
   304 
   305   if (klass->oop_is_array()) {
   305   if (klass->is_array_klass()) {
   306     // Only consider klass and super klass for arrays
   306     // Only consider klass and super klass for arrays
   307     return methodHandle(THREAD, result);
   307     return methodHandle(THREAD, result);
   308   }
   308   }
   309 
   309 
   310   InstanceKlass* ik = InstanceKlass::cast(klass());
   310   InstanceKlass* ik = InstanceKlass::cast(klass());
   353   while (result != NULL && result->is_static() && result->method_holder()->super() != NULL) {
   353   while (result != NULL && result->is_static() && result->method_holder()->super() != NULL) {
   354     Klass* super_klass = result->method_holder()->super();
   354     Klass* super_klass = result->method_holder()->super();
   355     result = super_klass->uncached_lookup_method(name, signature, Klass::find_overpass);
   355     result = super_klass->uncached_lookup_method(name, signature, Klass::find_overpass);
   356   }
   356   }
   357 
   357 
   358   if (klass->oop_is_array()) {
   358   if (klass->is_array_klass()) {
   359     // Only consider klass and super klass for arrays
   359     // Only consider klass and super klass for arrays
   360     return methodHandle(THREAD, result);
   360     return methodHandle(THREAD, result);
   361   }
   361   }
   362 
   362 
   363   if (result == NULL) {
   363   if (result == NULL) {
   529   //
   529   //
   530   // We'll check for the method name first, as that's most likely
   530   // We'll check for the method name first, as that's most likely
   531   // to be false (so we'll short-circuit out of these tests).
   531   // to be false (so we'll short-circuit out of these tests).
   532   if (sel_method->name() == vmSymbols::clone_name() &&
   532   if (sel_method->name() == vmSymbols::clone_name() &&
   533       sel_klass() == SystemDictionary::Object_klass() &&
   533       sel_klass() == SystemDictionary::Object_klass() &&
   534       resolved_klass->oop_is_array()) {
   534       resolved_klass->is_array_klass()) {
   535     // We need to change "protected" to "public".
   535     // We need to change "protected" to "public".
   536     assert(flags.is_protected(), "clone not protected?");
   536     assert(flags.is_protected(), "clone not protected?");
   537     jint new_flags = flags.as_int();
   537     jint new_flags = flags.as_int();
   538     new_flags = new_flags & (~JVM_ACC_PROTECTED);
   538     new_flags = new_flags & (~JVM_ACC_PROTECTED);
   539     new_flags = new_flags | JVM_ACC_PUBLIC;
   539     new_flags = new_flags | JVM_ACC_PUBLIC;
   682   }
   682   }
   683 
   683 
   684   // 2. lookup method in resolved klass and its super klasses
   684   // 2. lookup method in resolved klass and its super klasses
   685   methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL);
   685   methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL);
   686 
   686 
   687   if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy
   687   if (resolved_method.is_null() && !resolved_klass->is_array_klass()) { // not found in the class hierarchy
   688     // 3. lookup method in all the interfaces implemented by the resolved klass
   688     // 3. lookup method in all the interfaces implemented by the resolved klass
   689     resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
   689     resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
   690 
   690 
   691     if (resolved_method.is_null()) {
   691     if (resolved_method.is_null()) {
   692       // JSR 292:  see if this is an implicitly generated method MethodHandle.linkToVirtual(*...), etc
   692       // JSR 292:  see if this is an implicitly generated method MethodHandle.linkToVirtual(*...), etc
   742 
   742 
   743   // lookup method in this interface or its super, java.lang.Object
   743   // lookup method in this interface or its super, java.lang.Object
   744   // JDK8: also look for static methods
   744   // JDK8: also look for static methods
   745   methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL);
   745   methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL);
   746 
   746 
   747   if (resolved_method.is_null() && !resolved_klass->oop_is_array()) {
   747   if (resolved_method.is_null() && !resolved_klass->is_array_klass()) {
   748     // lookup method in all the super-interfaces
   748     // lookup method in all the super-interfaces
   749     resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
   749     resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL);
   750   }
   750   }
   751 
   751 
   752   if (resolved_method.is_null()) {
   752   if (resolved_method.is_null()) {