< prev index next >

src/share/vm/utilities/exceptions.cpp

Print this page




  68 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
  69   // bootstrapping check
  70   if (!Universe::is_fully_initialized()) {
  71    vm_exit_during_initialization(h_exception);
  72    ShouldNotReachHere();
  73   }
  74 
  75 #ifdef ASSERT
  76   // Check for trying to throw stack overflow before initialization is complete
  77   // to prevent infinite recursion trying to initialize stack overflow without
  78   // adequate stack space.
  79   // This can happen with stress testing a large value of StackShadowPages
  80   if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
  81     InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
  82     assert(ik->is_initialized(),
  83            "need to increase min_stack_allowed calculation");
  84   }
  85 #endif // ASSERT
  86 
  87   if (thread->is_VM_thread()
  88       || thread->is_Compiler_thread()
  89       || DumpSharedSpaces ) {
  90     // We do not care what kind of exception we get for the vm-thread or a thread which
  91     // is compiling.  We just install a dummy exception object
  92     //
  93     // We also cannot throw a proper exception when dumping, because we cannot run
  94     // Java bytecodes now. A dummy exception will suffice.
  95     thread->set_pending_exception(Universe::vm_exception(), file, line);
  96     return true;
  97   }
  98 
  99   return false;
 100 }
 101 
 102 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Symbol* h_name, const char* message) {
 103   // bootstrapping check
 104   if (!Universe::is_fully_initialized()) {
 105     if (h_name == NULL) {
 106       // atleast an informative message.
 107       vm_exit_during_initialization("Exception", message);
 108     } else {
 109       vm_exit_during_initialization(h_name, message);
 110     }
 111     ShouldNotReachHere();
 112   }
 113 
 114   if (thread->is_VM_thread()
 115       || thread->is_Compiler_thread()
 116       || DumpSharedSpaces ) {
 117     // We do not care what kind of exception we get for the vm-thread or a thread which
 118     // is compiling.  We just install a dummy exception object
 119     //
 120     // We also cannot throw a proper exception when dumping, because we cannot run
 121     // Java bytecodes now. A dummy exception will suffice.
 122     thread->set_pending_exception(Universe::vm_exception(), file, line);
 123     return true;
 124   }
 125   return false;
 126 }
 127 
 128 // This method should only be called from generated code,
 129 // therefore the exception oop should be in the oopmap.
 130 void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exception) {
 131   assert(exception != NULL, "exception should not be NULL");
 132   Handle h_exception = Handle(thread, exception);
 133   _throw(thread, file, line, h_exception);
 134 }
 135 




  68 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
  69   // bootstrapping check
  70   if (!Universe::is_fully_initialized()) {
  71    vm_exit_during_initialization(h_exception);
  72    ShouldNotReachHere();
  73   }
  74 
  75 #ifdef ASSERT
  76   // Check for trying to throw stack overflow before initialization is complete
  77   // to prevent infinite recursion trying to initialize stack overflow without
  78   // adequate stack space.
  79   // This can happen with stress testing a large value of StackShadowPages
  80   if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
  81     InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
  82     assert(ik->is_initialized(),
  83            "need to increase min_stack_allowed calculation");
  84   }
  85 #endif // ASSERT
  86 
  87   if (thread->is_VM_thread()
  88       || !thread->can_call_java()
  89       || DumpSharedSpaces ) {
  90     // We do not care what kind of exception we get for the vm-thread or a thread which
  91     // is compiling.  We just install a dummy exception object
  92     //
  93     // We also cannot throw a proper exception when dumping, because we cannot run
  94     // Java bytecodes now. A dummy exception will suffice.
  95     thread->set_pending_exception(Universe::vm_exception(), file, line);
  96     return true;
  97   }
  98 
  99   return false;
 100 }
 101 
 102 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Symbol* h_name, const char* message) {
 103   // bootstrapping check
 104   if (!Universe::is_fully_initialized()) {
 105     if (h_name == NULL) {
 106       // atleast an informative message.
 107       vm_exit_during_initialization("Exception", message);
 108     } else {
 109       vm_exit_during_initialization(h_name, message);
 110     }
 111     ShouldNotReachHere();
 112   }
 113 
 114   if (thread->is_VM_thread()
 115       || !thread->can_call_java()
 116       || DumpSharedSpaces ) {
 117     // We do not care what kind of exception we get for the vm-thread or a thread which
 118     // is compiling.  We just install a dummy exception object
 119     //
 120     // We also cannot throw a proper exception when dumping, because we cannot run
 121     // Java bytecodes now. A dummy exception will suffice.
 122     thread->set_pending_exception(Universe::vm_exception(), file, line);
 123     return true;
 124   }
 125   return false;
 126 }
 127 
 128 // This method should only be called from generated code,
 129 // therefore the exception oop should be in the oopmap.
 130 void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exception) {
 131   assert(exception != NULL, "exception should not be NULL");
 132   Handle h_exception = Handle(thread, exception);
 133   _throw(thread, file, line, h_exception);
 134 }
 135 


< prev index next >