< prev index next >

src/share/vm/runtime/sharedRuntime.cpp

Print this page




 622   if (method->is_obsolete()) {
 623     // We are calling an obsolete method, but this is not necessarily
 624     // an error. Our method could have been redefined just after we
 625     // fetched the Method* from the constant pool.
 626 
 627     // RC_TRACE macro has an embedded ResourceMark
 628     RC_TRACE_WITH_THREAD(0x00001000, thread,
 629                          ("calling obsolete method '%s'",
 630                           method->name_and_sig_as_C_string()));
 631     if (RC_TRACE_ENABLED(0x00002000)) {
 632       // this option is provided to debug calls to obsolete methods
 633       guarantee(false, "faulting at call to an obsolete method.");
 634     }
 635   }
 636   return 0;
 637 JRT_END
 638 
 639 // ret_pc points into caller; we are returning caller's exception handler
 640 // for given exception
 641 address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
 642                                                     bool force_unwind, bool top_frame_only) {
 643   assert(nm != NULL, "must exist");
 644   ResourceMark rm;
 645 
 646   ScopeDesc* sd = nm->scope_desc_at(ret_pc);
 647   // determine handler bci, if any
 648   EXCEPTION_MARK;
 649 
 650   int handler_bci = -1;
 651   int scope_depth = 0;
 652   if (!force_unwind) {
 653     int bci = sd->bci();
 654     bool recursive_exception = false;
 655     do {
 656       bool skip_scope_increment = false;
 657       // exception handler lookup
 658       KlassHandle ek (THREAD, exception->klass());
 659       methodHandle mh(THREAD, sd->method());
 660       handler_bci = Method::fast_exception_handler_bci_for(mh, ek, bci, THREAD);
 661       if (HAS_PENDING_EXCEPTION) {
 662         recursive_exception = true;
 663         // We threw an exception while trying to find the exception handler.
 664         // Transfer the new exception to the exception handle which will
 665         // be set into thread local storage, and do another lookup for an
 666         // exception handler for this exception, this time starting at the
 667         // BCI of the exception handler which caused the exception to be
 668         // thrown (bugs 4307310 and 4546590). Set "exception" reference
 669         // argument to ensure that the correct exception is thrown (4870175).

 670         exception = Handle(THREAD, PENDING_EXCEPTION);
 671         CLEAR_PENDING_EXCEPTION;
 672         if (handler_bci >= 0) {
 673           bci = handler_bci;
 674           handler_bci = -1;
 675           skip_scope_increment = true;
 676         }
 677       }
 678       else {
 679         recursive_exception = false;
 680       }
 681       if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) {
 682         sd = sd->sender();
 683         if (sd != NULL) {
 684           bci = sd->bci();
 685         }
 686         ++scope_depth;
 687       }
 688     } while (recursive_exception || (!top_frame_only && handler_bci < 0 && sd != NULL));
 689   }




 622   if (method->is_obsolete()) {
 623     // We are calling an obsolete method, but this is not necessarily
 624     // an error. Our method could have been redefined just after we
 625     // fetched the Method* from the constant pool.
 626 
 627     // RC_TRACE macro has an embedded ResourceMark
 628     RC_TRACE_WITH_THREAD(0x00001000, thread,
 629                          ("calling obsolete method '%s'",
 630                           method->name_and_sig_as_C_string()));
 631     if (RC_TRACE_ENABLED(0x00002000)) {
 632       // this option is provided to debug calls to obsolete methods
 633       guarantee(false, "faulting at call to an obsolete method.");
 634     }
 635   }
 636   return 0;
 637 JRT_END
 638 
 639 // ret_pc points into caller; we are returning caller's exception handler
 640 // for given exception
 641 address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
 642                                                     bool force_unwind, bool top_frame_only, bool& recursive_exception_occurred) {
 643   assert(nm != NULL, "must exist");
 644   ResourceMark rm;
 645 
 646   ScopeDesc* sd = nm->scope_desc_at(ret_pc);
 647   // determine handler bci, if any
 648   EXCEPTION_MARK;
 649 
 650   int handler_bci = -1;
 651   int scope_depth = 0;
 652   if (!force_unwind) {
 653     int bci = sd->bci();
 654     bool recursive_exception = false;
 655     do {
 656       bool skip_scope_increment = false;
 657       // exception handler lookup
 658       KlassHandle ek (THREAD, exception->klass());
 659       methodHandle mh(THREAD, sd->method());
 660       handler_bci = Method::fast_exception_handler_bci_for(mh, ek, bci, THREAD);
 661       if (HAS_PENDING_EXCEPTION) {
 662         recursive_exception = true;
 663         // We threw an exception while trying to find the exception handler.
 664         // Transfer the new exception to the exception handle which will
 665         // be set into thread local storage, and do another lookup for an
 666         // exception handler for this exception, this time starting at the
 667         // BCI of the exception handler which caused the exception to be
 668         // thrown (bugs 4307310 and 4546590). Set "exception" reference
 669         // argument to ensure that the correct exception is thrown (4870175).
 670         recursive_exception_occurred = true;
 671         exception = Handle(THREAD, PENDING_EXCEPTION);
 672         CLEAR_PENDING_EXCEPTION;
 673         if (handler_bci >= 0) {
 674           bci = handler_bci;
 675           handler_bci = -1;
 676           skip_scope_increment = true;
 677         }
 678       }
 679       else {
 680         recursive_exception = false;
 681       }
 682       if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) {
 683         sd = sd->sender();
 684         if (sd != NULL) {
 685           bci = sd->bci();
 686         }
 687         ++scope_depth;
 688       }
 689     } while (recursive_exception || (!top_frame_only && handler_bci < 0 && sd != NULL));
 690   }


< prev index next >