comparison 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
comparison
equal deleted inserted replaced
3743:33e2b8f1d466 3744:60b8287df30e
1115 1115
1116 // JSR 292: this must be an implicitly generated method MethodHandle.invokeExact(*...) 1116 // JSR 292: this must be an implicitly generated method MethodHandle.invokeExact(*...)
1117 // The extra MH receiver will be inserted into the stack on every call. 1117 // The extra MH receiver will be inserted into the stack on every call.
1118 methodHandle resolved_method; 1118 methodHandle resolved_method;
1119 KlassHandle current_klass(THREAD, pool->pool_holder()); 1119 KlassHandle current_klass(THREAD, pool->pool_holder());
1120 lookup_implicit_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, CHECK); 1120 lookup_implicit_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, THREAD);
1121 if (HAS_PENDING_EXCEPTION) {
1122 if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
1123 // throw these guys, since they are already wrapped
1124 return;
1125 }
1126 if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) {
1127 // intercept only LinkageErrors which might have failed to wrap
1128 return;
1129 }
1130 // See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS.
1131 Handle ex(THREAD, PENDING_EXCEPTION);
1132 CLEAR_PENDING_EXCEPTION;
1133 oop bsme = Klass::cast(SystemDictionary::BootstrapMethodError_klass())->java_mirror();
1134 MethodHandles::raise_exception(Bytecodes::_athrow, ex(), bsme, CHECK);
1135 // java code should not return, but if it does throw out anyway
1136 THROW(vmSymbols::java_lang_InternalError());
1137 }
1121 if (resolved_method.is_null()) { 1138 if (resolved_method.is_null()) {
1122 THROW(vmSymbols::java_lang_InternalError()); 1139 THROW(vmSymbols::java_lang_InternalError());
1123 } 1140 }
1124 result.set_dynamic(resolved_method, CHECK); 1141 result.set_dynamic(resolved_method, CHECK);
1125 } 1142 }