hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 10731 ffe24d6f0575
parent 10254 406448a00c51
child 10740 a6fdc8d6c13c
equal deleted inserted replaced
10730:38dcf027574e 10731:ffe24d6f0575
   657 
   657 
   658   int handler_bci = -1;
   658   int handler_bci = -1;
   659   int scope_depth = 0;
   659   int scope_depth = 0;
   660   if (!force_unwind) {
   660   if (!force_unwind) {
   661     int bci = sd->bci();
   661     int bci = sd->bci();
       
   662     bool recursive_exception = false;
   662     do {
   663     do {
   663       bool skip_scope_increment = false;
   664       bool skip_scope_increment = false;
   664       // exception handler lookup
   665       // exception handler lookup
   665       KlassHandle ek (THREAD, exception->klass());
   666       KlassHandle ek (THREAD, exception->klass());
   666       handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
   667       handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
   667       if (HAS_PENDING_EXCEPTION) {
   668       if (HAS_PENDING_EXCEPTION) {
       
   669         recursive_exception = true;
   668         // We threw an exception while trying to find the exception handler.
   670         // We threw an exception while trying to find the exception handler.
   669         // Transfer the new exception to the exception handle which will
   671         // Transfer the new exception to the exception handle which will
   670         // be set into thread local storage, and do another lookup for an
   672         // be set into thread local storage, and do another lookup for an
   671         // exception handler for this exception, this time starting at the
   673         // exception handler for this exception, this time starting at the
   672         // BCI of the exception handler which caused the exception to be
   674         // BCI of the exception handler which caused the exception to be
   678           bci = handler_bci;
   680           bci = handler_bci;
   679           handler_bci = -1;
   681           handler_bci = -1;
   680           skip_scope_increment = true;
   682           skip_scope_increment = true;
   681         }
   683         }
   682       }
   684       }
       
   685       else {
       
   686         recursive_exception = false;
       
   687       }
   683       if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) {
   688       if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) {
   684         sd = sd->sender();
   689         sd = sd->sender();
   685         if (sd != NULL) {
   690         if (sd != NULL) {
   686           bci = sd->bci();
   691           bci = sd->bci();
   687         }
   692         }
   688         ++scope_depth;
   693         ++scope_depth;
   689       }
   694       }
   690     } while (!top_frame_only && handler_bci < 0 && sd != NULL);
   695     } while (recursive_exception || (!top_frame_only && handler_bci < 0 && sd != NULL));
   691   }
   696   }
   692 
   697 
   693   // found handling method => lookup exception handler
   698   // found handling method => lookup exception handler
   694   int catch_pco = ret_pc - nm->code_begin();
   699   int catch_pco = ret_pc - nm->code_begin();
   695 
   700