src/share/vm/c1/c1_Runtime1.cpp

Print this page
rev 1122 : refactored to check all 3 can_post_exception bits and other Dan comments


 420     // if the frame isn't deopted then pc must not correspond to the caller of last_frame
 421     assert(exception_frame.is_deoptimized_frame(), "must be deopted");
 422     pc = exception_frame.pc();
 423   }
 424 #ifdef ASSERT
 425   assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
 426   assert(exception->is_oop(), "just checking");
 427   // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
 428   if (!(exception->is_a(SystemDictionary::throwable_klass()))) {
 429     if (ExitVMOnVerifyError) vm_exit(-1);
 430     ShouldNotReachHere();
 431   }
 432 #endif
 433 
 434   // Check the stack guard pages and reenable them if necessary and there is
 435   // enough space on the stack to do so.  Use fast exceptions only if the guard
 436   // pages are enabled.
 437   bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
 438   if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
 439 
 440   if (JvmtiExport::can_post_exceptions()) {
 441     // To ensure correct notification of exception catches and throws
 442     // we have to deoptimize here.  If we attempted to notify the
 443     // catches and throws during this exception lookup it's possible
 444     // we could deoptimize on the way out of the VM and end back in
 445     // the interpreter at the throw site.  This would result in double
 446     // notifications since the interpreter would also notify about
 447     // these same catches and throws as it unwound the frame.
 448 
 449     RegisterMap reg_map(thread);
 450     frame stub_frame = thread->last_frame();
 451     frame caller_frame = stub_frame.sender(&reg_map);
 452 
 453     // We don't really want to deoptimize the nmethod itself since we
 454     // can actually continue in the exception handler ourselves but I
 455     // don't see an easy way to have the desired effect.
 456     VM_DeoptimizeFrame deopt(thread, caller_frame.id());
 457     VMThread::execute(&deopt);
 458 
 459     return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
 460   }




 420     // if the frame isn't deopted then pc must not correspond to the caller of last_frame
 421     assert(exception_frame.is_deoptimized_frame(), "must be deopted");
 422     pc = exception_frame.pc();
 423   }
 424 #ifdef ASSERT
 425   assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
 426   assert(exception->is_oop(), "just checking");
 427   // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
 428   if (!(exception->is_a(SystemDictionary::throwable_klass()))) {
 429     if (ExitVMOnVerifyError) vm_exit(-1);
 430     ShouldNotReachHere();
 431   }
 432 #endif
 433 
 434   // Check the stack guard pages and reenable them if necessary and there is
 435   // enough space on the stack to do so.  Use fast exceptions only if the guard
 436   // pages are enabled.
 437   bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
 438   if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
 439 
 440   if (thread->should_post_on_exceptions_flag()) {
 441     // To ensure correct notification of exception catches and throws
 442     // we have to deoptimize here.  If we attempted to notify the
 443     // catches and throws during this exception lookup it's possible
 444     // we could deoptimize on the way out of the VM and end back in
 445     // the interpreter at the throw site.  This would result in double
 446     // notifications since the interpreter would also notify about
 447     // these same catches and throws as it unwound the frame.
 448 
 449     RegisterMap reg_map(thread);
 450     frame stub_frame = thread->last_frame();
 451     frame caller_frame = stub_frame.sender(&reg_map);
 452 
 453     // We don't really want to deoptimize the nmethod itself since we
 454     // can actually continue in the exception handler ourselves but I
 455     // don't see an easy way to have the desired effect.
 456     VM_DeoptimizeFrame deopt(thread, caller_frame.id());
 457     VMThread::execute(&deopt);
 458 
 459     return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
 460   }