8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError

Do not update exception cache if exception is replaced when thrown

Reviewed-by: kvn, iveresov
This commit is contained in:
Roland Westrelin 2014-08-11 15:09:04 +02:00
parent dc1afd4abe
commit fa334043fe
2 changed files with 50 additions and 1 deletions

View file

@ -546,13 +546,18 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
// normal bytecode execution.
thread->clear_exception_oop_and_pc();
Handle original_exception(thread, exception());
continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
// If an exception was thrown during exception dispatch, the exception oop may have changed
thread->set_exception_oop(exception());
thread->set_exception_pc(pc);
// the exception cache is used only by non-implicit exceptions
if (continuation != NULL) {
// Update the exception cache only when there didn't happen
// another exception during the computation of the compiled
// exception handler.
if (continuation != NULL && original_exception() == exception()) {
nm->add_handler_for_exception_and_pc(exception, pc, continuation);
}
}