< prev index next >

src/hotspot/share/utilities/exceptions.cpp

Print this page

 65   LogTarget(Debug, exceptions) lt;
 66   if (_pending_exception != nullptr && lt.is_enabled()) {
 67     ResourceMark rm;
 68     LogStream ls(lt);
 69     ls.print("Thread::clear_pending_exception: cleared exception:");
 70     _pending_exception->print_on(&ls);
 71   }
 72   _pending_exception = nullptr;
 73   _exception_file    = nullptr;
 74   _exception_line    = 0;
 75 }
 76 
 77 void ThreadShadow::clear_pending_nonasync_exception() {
 78   // Do not clear probable async exceptions.
 79   if ((_pending_exception->klass() != vmClasses::InternalError_klass() ||
 80        java_lang_InternalError::during_unsafe_access(_pending_exception) != JNI_TRUE)) {
 81     clear_pending_exception();
 82   }
 83 }
 84 





















 85 // Implementation of Exceptions
 86 
 87 bool Exceptions::special_exception(JavaThread* thread, const char* file, int line, Handle h_exception, Symbol* h_name, const char* message) {
 88   assert(h_exception.is_null() != (h_name == nullptr), "either exception (" PTR_FORMAT ") or "
 89          "symbol (" PTR_FORMAT ") must be non-null but not both", p2i(h_exception()), p2i(h_name));
 90 
 91   // bootstrapping check
 92   if (!Universe::is_fully_initialized()) {
 93     if (h_exception.not_null()) {
 94       vm_exit_during_initialization(h_exception);
 95     } else if (h_name == nullptr) {
 96       // at least an informative message.
 97       vm_exit_during_initialization("Exception", message);
 98     } else {
 99       vm_exit_during_initialization(h_name, message);
100     }
101    ShouldNotReachHere();
102   }
103 
104 #ifdef ASSERT

 65   LogTarget(Debug, exceptions) lt;
 66   if (_pending_exception != nullptr && lt.is_enabled()) {
 67     ResourceMark rm;
 68     LogStream ls(lt);
 69     ls.print("Thread::clear_pending_exception: cleared exception:");
 70     _pending_exception->print_on(&ls);
 71   }
 72   _pending_exception = nullptr;
 73   _exception_file    = nullptr;
 74   _exception_line    = 0;
 75 }
 76 
 77 void ThreadShadow::clear_pending_nonasync_exception() {
 78   // Do not clear probable async exceptions.
 79   if ((_pending_exception->klass() != vmClasses::InternalError_klass() ||
 80        java_lang_InternalError::during_unsafe_access(_pending_exception) != JNI_TRUE)) {
 81     clear_pending_exception();
 82   }
 83 }
 84 
 85 void ThreadShadow::set_pending_preempted_exception() {
 86   assert(!has_pending_exception(), "");
 87   // We always install the same dummy exception since we only want
 88   // to use the TRAPS mechaninsm to bail out from all methods until
 89   // reaching the one using the CHECK_AND_CLEAR_PREEMPTED macro.
 90   set_pending_exception(Universe::preempted_exception_instance(), __FILE__, __LINE__);
 91 }
 92 
 93 void ThreadShadow::clear_pending_preempted_exception() {
 94   if (_pending_exception->klass() == vmClasses::PreemptedException_klass()) {
 95     clear_pending_exception();
 96   }
 97 }
 98 
 99 #ifdef ASSERT
100 void ThreadShadow::check_preempted_exception() {
101   assert(has_pending_exception(), "");
102   assert(pending_exception()->is_a(vmClasses::PreemptedException_klass()), "");
103 }
104 #endif
105 
106 // Implementation of Exceptions
107 
108 bool Exceptions::special_exception(JavaThread* thread, const char* file, int line, Handle h_exception, Symbol* h_name, const char* message) {
109   assert(h_exception.is_null() != (h_name == nullptr), "either exception (" PTR_FORMAT ") or "
110          "symbol (" PTR_FORMAT ") must be non-null but not both", p2i(h_exception()), p2i(h_name));
111 
112   // bootstrapping check
113   if (!Universe::is_fully_initialized()) {
114     if (h_exception.not_null()) {
115       vm_exit_during_initialization(h_exception);
116     } else if (h_name == nullptr) {
117       // at least an informative message.
118       vm_exit_during_initialization("Exception", message);
119     } else {
120       vm_exit_during_initialization(h_name, message);
121     }
122    ShouldNotReachHere();
123   }
124 
125 #ifdef ASSERT
< prev index next >