< prev index next >
src/share/vm/interpreter/linkResolver.cpp
Print this page
@@ -1688,12 +1688,18 @@
// Resolve the bootstrap specifier (BSM + optional arguments).
Handle bootstrap_specifier;
// Check if CallSite has been bound already:
ConstantPoolCacheEntry* cpce = pool->invokedynamic_cp_cache_entry_at(index);
- if (cpce->is_f1_null()) {
int pool_index = cpce->constant_pool_index();
+ if (pool()->tag_at(pool_index).is_invoke_dynamic_in_error()) {
+ // Throw saved exception.
+ ConstantPool::throw_resolution_error(pool, pool_index, CHECK);
+ return;
+ }
+
+ if (cpce->is_f1_null()) {
oop bsm_info = pool->resolve_bootstrap_specifier_at(pool_index, THREAD);
wrap_invokedynamic_exception(CHECK);
assert(bsm_info != NULL, "");
// FIXME: Cache this once per BootstrapMethods entry, not once per CONSTANT_InvokeDynamic.
bootstrap_specifier = Handle(THREAD, bsm_info);
@@ -1714,11 +1720,21 @@
method_name->as_C_string(), method_signature->as_C_string(),
current_klass->name()->as_C_string());
tty->print(" BSM info: "); bootstrap_specifier->print();
}
- resolve_dynamic_call(result, bootstrap_specifier, method_name, method_signature, current_klass, CHECK);
+ resolve_dynamic_call(result, bootstrap_specifier, method_name, method_signature, current_klass, THREAD);
+ if (HAS_PENDING_EXCEPTION) {
+ if (pool()->tag_at(pool_index).is_invoke_dynamic()&&
+ PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) {
+ // Record the exception then throw it.
+ ConstantPool::save_and_throw_exception(pool, pool_index, pool()->tag_at(pool_index), CHECK);
+ } else if (pool()->tag_at(pool_index).is_invoke_dynamic_in_error()) {
+ // Throw saved exception.
+ ConstantPool::throw_resolution_error(pool, pool_index, CHECK);
+ } // else return the original exception.
+ }
}
void LinkResolver::resolve_dynamic_call(CallInfo& result,
Handle bootstrap_specifier,
Symbol* method_name, Symbol* method_signature,
< prev index next >