src/share/vm/runtime/sharedRuntime.cpp

Print this page




 625 // ret_pc points into caller; we are returning caller's exception handler
 626 // for given exception
 627 address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
 628                                                     bool force_unwind, bool top_frame_only) {
 629   assert(nm != NULL, "must exist");
 630   ResourceMark rm;
 631 
 632   ScopeDesc* sd = nm->scope_desc_at(ret_pc);
 633   // determine handler bci, if any
 634   EXCEPTION_MARK;
 635 
 636   int handler_bci = -1;
 637   int scope_depth = 0;
 638   if (!force_unwind) {
 639     int bci = sd->bci();
 640     bool recursive_exception = false;
 641     do {
 642       bool skip_scope_increment = false;
 643       // exception handler lookup
 644       KlassHandle ek (THREAD, exception->klass());
 645       handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
 646       if (HAS_PENDING_EXCEPTION) {
 647         recursive_exception = true;
 648         // We threw an exception while trying to find the exception handler.
 649         // Transfer the new exception to the exception handle which will
 650         // be set into thread local storage, and do another lookup for an
 651         // exception handler for this exception, this time starting at the
 652         // BCI of the exception handler which caused the exception to be
 653         // thrown (bugs 4307310 and 4546590). Set "exception" reference
 654         // argument to ensure that the correct exception is thrown (4870175).
 655         exception = Handle(THREAD, PENDING_EXCEPTION);
 656         CLEAR_PENDING_EXCEPTION;
 657         if (handler_bci >= 0) {
 658           bci = handler_bci;
 659           handler_bci = -1;
 660           skip_scope_increment = true;
 661         }
 662       }
 663       else {
 664         recursive_exception = false;
 665       }




 625 // ret_pc points into caller; we are returning caller's exception handler
 626 // for given exception
 627 address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
 628                                                     bool force_unwind, bool top_frame_only) {
 629   assert(nm != NULL, "must exist");
 630   ResourceMark rm;
 631 
 632   ScopeDesc* sd = nm->scope_desc_at(ret_pc);
 633   // determine handler bci, if any
 634   EXCEPTION_MARK;
 635 
 636   int handler_bci = -1;
 637   int scope_depth = 0;
 638   if (!force_unwind) {
 639     int bci = sd->bci();
 640     bool recursive_exception = false;
 641     do {
 642       bool skip_scope_increment = false;
 643       // exception handler lookup
 644       KlassHandle ek (THREAD, exception->klass());
 645       handler_bci = methodOopDesc::fast_exception_handler_bci_for(sd->method(), ek, bci, THREAD);
 646       if (HAS_PENDING_EXCEPTION) {
 647         recursive_exception = true;
 648         // We threw an exception while trying to find the exception handler.
 649         // Transfer the new exception to the exception handle which will
 650         // be set into thread local storage, and do another lookup for an
 651         // exception handler for this exception, this time starting at the
 652         // BCI of the exception handler which caused the exception to be
 653         // thrown (bugs 4307310 and 4546590). Set "exception" reference
 654         // argument to ensure that the correct exception is thrown (4870175).
 655         exception = Handle(THREAD, PENDING_EXCEPTION);
 656         CLEAR_PENDING_EXCEPTION;
 657         if (handler_bci >= 0) {
 658           bci = handler_bci;
 659           handler_bci = -1;
 660           skip_scope_increment = true;
 661         }
 662       }
 663       else {
 664         recursive_exception = false;
 665       }