hotspot/src/share/vm/utilities/exceptions.cpp
changeset 19158 9c755bf7cae5
parent 14583 d70ee55535f4
child 22234 da823d78ad65
equal deleted inserted replaced
19157:da59f0d17387 19158:9c755bf7cae5
   123   Handle h_exception = Handle(thread, exception);
   123   Handle h_exception = Handle(thread, exception);
   124   _throw(thread, file, line, h_exception);
   124   _throw(thread, file, line, h_exception);
   125 }
   125 }
   126 
   126 
   127 void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
   127 void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
       
   128   ResourceMark rm;
   128   assert(h_exception() != NULL, "exception should not be NULL");
   129   assert(h_exception() != NULL, "exception should not be NULL");
   129 
   130 
   130   // tracing (do this up front - so it works during boot strapping)
   131   // tracing (do this up front - so it works during boot strapping)
   131   if (TraceExceptions) {
   132   if (TraceExceptions) {
   132     ttyLocker ttyl;
   133     ttyLocker ttyl;
   133     ResourceMark rm;
   134     tty->print_cr("Exception <%s%s%s> (" INTPTR_FORMAT ") \n"
   134     tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n"
       
   135                   "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
   135                   "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
   136                   h_exception->print_value_string(),
   136                   h_exception->print_value_string(),
   137                   message ? ": " : "", message ? message : "",
   137                   message ? ": " : "", message ? message : "",
   138                   (address)h_exception(), file, line, thread);
   138                   (address)h_exception(), file, line, thread);
   139   }
   139   }
   140   // for AbortVMOnException flag
   140   // for AbortVMOnException flag
   141   NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
   141   NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
   142 
   142 
   143   // Check for special boot-strapping/vm-thread handling
   143   // Check for special boot-strapping/vm-thread handling
   144   if (special_exception(thread, file, line, h_exception)) return;
   144   if (special_exception(thread, file, line, h_exception)) {
       
   145     return;
       
   146   }
   145 
   147 
   146   assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
   148   assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
   147 
   149 
   148   // set the pending exception
   150   // set the pending exception
   149   thread->set_pending_exception(h_exception(), file, line);
   151   thread->set_pending_exception(h_exception(), file, line);
   150 
   152 
   151   // vm log
   153   // vm log
   152   Events::log_exception(thread, "Threw " INTPTR_FORMAT " at %s:%d", (address)h_exception(), file, line);
   154   Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]",
       
   155                         h_exception->print_value_string(), message ? ": " : "", message ? message : "",
       
   156                         (address)h_exception(), file, line);
   153 }
   157 }
   154 
   158 
   155 
   159 
   156 void Exceptions::_throw_msg(Thread* thread, const char* file, int line, Symbol* name, const char* message,
   160 void Exceptions::_throw_msg(Thread* thread, const char* file, int line, Symbol* name, const char* message,
   157                             Handle h_loader, Handle h_protection_domain) {
   161                             Handle h_loader, Handle h_protection_domain) {