--- old/src/share/vm/interpreter/linkResolver.cpp 2017-06-08 09:09:10.433801822 -0400 +++ new/src/share/vm/interpreter/linkResolver.cpp 2017-06-08 09:09:10.328679983 -0400 @@ -1690,8 +1690,14 @@ Handle bootstrap_specifier; // Check if CallSite has been bound already: ConstantPoolCacheEntry* cpce = pool->invokedynamic_cp_cache_entry_at(index); + 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()) { - int pool_index = cpce->constant_pool_index(); oop bsm_info = pool->resolve_bootstrap_specifier_at(pool_index, THREAD); wrap_invokedynamic_exception(CHECK); assert(bsm_info != NULL, ""); @@ -1716,7 +1722,17 @@ 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,