src/share/vm/opto/runtime.cpp

Print this page

        

*** 928,941 **** handler_address = force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); if (handler_address == NULL) { handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); assert (handler_address != NULL, "must have compiled handler"); ! // Update the exception cache only when the unwind was not forced. ! if (!force_unwind) { nm->add_handler_for_exception_and_pc(exception,pc,handler_address); } } else { assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); } --- 928,947 ---- handler_address = force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); if (handler_address == NULL) { + oop original_exception = exception(); handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); assert (handler_address != NULL, "must have compiled handler"); ! // Update the exception cache only when the unwind was not forced ! // and there didn't happen another exception during the computation of the ! // compiled exception handler. (Notice that the comparison below may wrongly fail ! // because a GC can happen while the compiled exception handler is computed. ! // But that should be a very rare case and updating the exception cache only ! // during the next exception occurence should have no measurable performance impact. ! if (!force_unwind && original_exception == exception()) { nm->add_handler_for_exception_and_pc(exception,pc,handler_address); } } else { assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); }