diff src/share/vm/opto/runtime.cpp @ 3998:ec5ce9326985

6865265: JVM crashes with "missing exception handler" error Summary: Retry the call to fast_exception_handler_bci_for() after it returned with a pending exception. Don't cache the exception handler pc computed by compute_compiled_exc_handler() if the handler is for another (nested) exception. Reviewed-by: kamg, kvn Contributed-by: volker.simonis@gmail.com
author kvn
date Tue, 04 Oct 2011 14:30:04 -0700
parents a92cdbac8b9e
children cec1757a0134
line wrap: on
line diff
--- a/src/share/vm/opto/runtime.cpp	Tue Oct 04 10:07:07 2011 -0700
+++ b/src/share/vm/opto/runtime.cpp	Tue Oct 04 14:30:04 2011 -0700
@@ -997,10 +997,13 @@
         force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
 
       if (handler_address == NULL) {
+        Handle original_exception(thread, 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.
-        if (!force_unwind) {
+        // 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.
+        if (!force_unwind && original_exception() == exception()) {
           nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
         }
       } else {