Mercurial > hg > truffle
diff src/share/vm/interpreter/linkResolver.cpp @ 3744:60b8287df30e
7049415: Failure of resolution of sym.reference to the c.s.s. should be wrapped in BootstrapMethodError
Summary: Delegate invokedynamic linkage errors to MethodHandleNatives.raiseException.
Reviewed-by: never
author | jrose |
---|---|
date | Wed, 01 Jun 2011 23:25:20 -0700 |
parents | acf5e660c71a |
children | 81d815b05abb |
line wrap: on
line diff
--- a/src/share/vm/interpreter/linkResolver.cpp Tue May 31 10:05:36 2011 -0700 +++ b/src/share/vm/interpreter/linkResolver.cpp Wed Jun 01 23:25:20 2011 -0700 @@ -1117,7 +1117,24 @@ // 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()); }