Mercurial > hg > truffle
comparison src/share/vm/interpreter/linkResolver.cpp @ 14221:2353011244bd
8027804: JCK resolveMethod test fails expecting AbstractMethodError
Summary: Create AME overpass methods and fix method search logic
Reviewed-by: kamg, acorn, lfoltan, coleenp
author | hseigel |
---|---|
date | Mon, 16 Dec 2013 08:24:33 -0500 |
parents | 252066a125de |
children | 7e072af80503 096a7e12d63f |
comparison
equal
deleted
inserted
replaced
14220:f9508a2fd4d8 | 14221:2353011244bd |
---|---|
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); |
1285 jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s", | 1289 jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s", |
1286 recv_klass()->external_name(), | 1290 recv_klass()->external_name(), |
1287 resolved_klass()->external_name()); | 1291 resolved_klass()->external_name()); |
1288 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); | 1292 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1289 } | 1293 } |
1294 | |
1290 // do lookup based on receiver klass | 1295 // do lookup based on receiver klass |
1291 methodHandle sel_method; | 1296 methodHandle sel_method; |
1297 // This search must match the linktime preparation search for itable initialization | |
1298 // to correctly enforce loader constraints for interface method inheritance | |
1292 lookup_instance_method_in_klasses(sel_method, recv_klass, | 1299 lookup_instance_method_in_klasses(sel_method, recv_klass, |
1293 resolved_method->name(), | 1300 resolved_method->name(), |
1294 resolved_method->signature(), CHECK); | 1301 resolved_method->signature(), CHECK); |
1295 if (sel_method.is_null() && !check_null_and_abstract) { | 1302 if (sel_method.is_null() && !check_null_and_abstract) { |
1296 // In theory this is a harmless placeholder value, but | 1303 // In theory this is a harmless placeholder value, but |