7049415: Failure of resolution of sym.reference to the c.s.s. should be wrapped in BootstrapMethodError

Delegate invokedynamic linkage errors to MethodHandleNatives.raiseException.

Reviewed-by: never
This commit is contained in:
John R Rose 2011-06-01 23:25:20 -07:00
parent a8556d6c01
commit 0ed03852e5
5 changed files with 66 additions and 13 deletions

View file

@ -1117,7 +1117,24 @@ void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle po
// The extra MH receiver will be inserted into the stack on every call.
methodHandle resolved_method;
KlassHandle current_klass(THREAD, pool->pool_holder());
lookup_implicit_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, CHECK);
lookup_implicit_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, THREAD);
if (HAS_PENDING_EXCEPTION) {
if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
// throw these guys, since they are already wrapped
return;
}
if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) {
// intercept only LinkageErrors which might have failed to wrap
return;
}
// See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS.
Handle ex(THREAD, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION;
oop bsme = Klass::cast(SystemDictionary::BootstrapMethodError_klass())->java_mirror();
MethodHandles::raise_exception(Bytecodes::_athrow, ex(), bsme, CHECK);
// java code should not return, but if it does throw out anyway
THROW(vmSymbols::java_lang_InternalError());
}
if (resolved_method.is_null()) {
THROW(vmSymbols::java_lang_InternalError());
}