464 465 // exception handler lookup 466 KlassHandle h_klass(THREAD, h_exception->klass()); 467 handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD); 468 if (HAS_PENDING_EXCEPTION) { 469 // We threw an exception while trying to find the exception handler. 470 // Transfer the new exception to the exception handle which will 471 // be set into thread local storage, and do another lookup for an 472 // exception handler for this exception, this time starting at the 473 // BCI of the exception handler which caused the exception to be 474 // thrown (bug 4307310). 475 h_exception = Handle(THREAD, PENDING_EXCEPTION); 476 CLEAR_PENDING_EXCEPTION; 477 if (handler_bci >= 0) { 478 current_bci = handler_bci; 479 should_repeat = true; 480 } 481 } 482 } while (should_repeat == true); 483 484 // notify JVMTI of an exception throw; JVMTI will detect if this is a first 485 // time throw or a stack unwinding throw and accordingly notify the debugger 486 if (JvmtiExport::can_post_on_exceptions()) { 487 JvmtiExport::post_exception_throw(thread, h_method(), bcp(thread), h_exception()); 488 } 489 490 #ifdef CC_INTERP 491 address continuation = (address)(intptr_t) handler_bci; 492 #else 493 address continuation = NULL; 494 #endif 495 address handler_pc = NULL; 496 if (handler_bci < 0 || !thread->reguard_stack((address) &continuation)) { 497 // Forward exception to callee (leaving bci/bcp untouched) because (a) no 498 // handler in this method, or (b) after a stack overflow there is not yet 499 // enough stack space available to reprotect the stack. 500 #ifndef CC_INTERP 501 continuation = Interpreter::remove_activation_entry(); 502 #endif 503 // Count this for compilation purposes | 464 465 // exception handler lookup 466 KlassHandle h_klass(THREAD, h_exception->klass()); 467 handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD); 468 if (HAS_PENDING_EXCEPTION) { 469 // We threw an exception while trying to find the exception handler. 470 // Transfer the new exception to the exception handle which will 471 // be set into thread local storage, and do another lookup for an 472 // exception handler for this exception, this time starting at the 473 // BCI of the exception handler which caused the exception to be 474 // thrown (bug 4307310). 475 h_exception = Handle(THREAD, PENDING_EXCEPTION); 476 CLEAR_PENDING_EXCEPTION; 477 if (handler_bci >= 0) { 478 current_bci = handler_bci; 479 should_repeat = true; 480 } 481 } 482 } while (should_repeat == true); 483 484 #if INCLUDE_JVMCI 485 if (UseJVMCICompiler && h_method->method_data() != NULL) { 486 ResourceMark rm(thread); 487 ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci, NULL); 488 if (pdata != NULL && pdata->is_BitData()) { 489 BitData* bit_data = (BitData*) pdata; 490 bit_data->set_exception_seen(); 491 } 492 } 493 #endif 494 495 // notify JVMTI of an exception throw; JVMTI will detect if this is a first 496 // time throw or a stack unwinding throw and accordingly notify the debugger 497 if (JvmtiExport::can_post_on_exceptions()) { 498 JvmtiExport::post_exception_throw(thread, h_method(), bcp(thread), h_exception()); 499 } 500 501 #ifdef CC_INTERP 502 address continuation = (address)(intptr_t) handler_bci; 503 #else 504 address continuation = NULL; 505 #endif 506 address handler_pc = NULL; 507 if (handler_bci < 0 || !thread->reguard_stack((address) &continuation)) { 508 // Forward exception to callee (leaving bci/bcp untouched) because (a) no 509 // handler in this method, or (b) after a stack overflow there is not yet 510 // enough stack space available to reprotect the stack. 511 #ifndef CC_INTERP 512 continuation = Interpreter::remove_activation_entry(); 513 #endif 514 // Count this for compilation purposes |