comparison src/share/vm/interpreter/linkResolver.cpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents a20be10ad437
children 52b4284cb496
comparison
equal deleted inserted replaced
17450:45b45f902bed 17524:89152779163c
298 int vtable_index = Method::invalid_vtable_index; 298 int vtable_index = Method::invalid_vtable_index;
299 Symbol* name = resolved_method->name(); 299 Symbol* name = resolved_method->name();
300 Symbol* signature = resolved_method->signature(); 300 Symbol* signature = resolved_method->signature();
301 301
302 // First check in default method array 302 // First check in default method array
303 if (!resolved_method->is_abstract() && 303 if (!resolved_method->is_abstract() &&
304 (InstanceKlass::cast(klass())->default_methods() != NULL)) { 304 (InstanceKlass::cast(klass())->default_methods() != NULL)) {
305 int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature); 305 int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature);
306 if (index >= 0 ) { 306 if (index >= 0 ) {
307 vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index); 307 vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index);
308 } 308 }
316 return vtable_index; 316 return vtable_index;
317 } 317 }
318 318
319 void LinkResolver::lookup_method_in_interfaces(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { 319 void LinkResolver::lookup_method_in_interfaces(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
320 InstanceKlass *ik = InstanceKlass::cast(klass()); 320 InstanceKlass *ik = InstanceKlass::cast(klass());
321 result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature)); 321
322 // Specify 'true' in order to skip default methods when searching the
323 // interfaces. Function lookup_method_in_klasses() already looked for
324 // the method in the default methods table.
325 result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature, true));
322 } 326 }
323 327
324 void LinkResolver::lookup_polymorphic_method(methodHandle& result, 328 void LinkResolver::lookup_polymorphic_method(methodHandle& result,
325 KlassHandle klass, Symbol* name, Symbol* full_signature, 329 KlassHandle klass, Symbol* name, Symbol* full_signature,
326 KlassHandle current_klass, 330 KlassHandle current_klass,
618 Symbol* method_signature, 622 Symbol* method_signature,
619 KlassHandle current_klass, 623 KlassHandle current_klass,
620 bool check_access, 624 bool check_access,
621 bool nostatics, TRAPS) { 625 bool nostatics, TRAPS) {
622 626
623 // check if klass is interface 627 // check if klass is interface
624 if (!resolved_klass->is_interface()) { 628 if (!resolved_klass->is_interface()) {
625 ResourceMark rm(THREAD); 629 ResourceMark rm(THREAD);
626 char buf[200]; 630 char buf[200];
627 jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass()->external_name()); 631 jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass()->external_name());
628 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); 632 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
1289 jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s", 1293 jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
1290 recv_klass()->external_name(), 1294 recv_klass()->external_name(),
1291 resolved_klass()->external_name()); 1295 resolved_klass()->external_name());
1292 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); 1296 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
1293 } 1297 }
1298
1294 // do lookup based on receiver klass 1299 // do lookup based on receiver klass
1295 methodHandle sel_method; 1300 methodHandle sel_method;
1301 // This search must match the linktime preparation search for itable initialization
1302 // to correctly enforce loader constraints for interface method inheritance
1296 lookup_instance_method_in_klasses(sel_method, recv_klass, 1303 lookup_instance_method_in_klasses(sel_method, recv_klass,
1297 resolved_method->name(), 1304 resolved_method->name(),
1298 resolved_method->signature(), CHECK); 1305 resolved_method->signature(), CHECK);
1299 if (sel_method.is_null() && !check_null_and_abstract) { 1306 if (sel_method.is_null() && !check_null_and_abstract) {
1300 // In theory this is a harmless placeholder value, but 1307 // In theory this is a harmless placeholder value, but