hotspot/src/share/vm/utilities/exceptions.cpp
changeset 6964 6e45ffa3bccf
parent 6179 4846648c4b7b
child 7397 5b173b4ca846
equal deleted inserted replaced
6963:58adcb17d304 6964:6e45ffa3bccf
    59   if (!Universe::is_fully_initialized()) {
    59   if (!Universe::is_fully_initialized()) {
    60    vm_exit_during_initialization(h_exception);
    60    vm_exit_during_initialization(h_exception);
    61    ShouldNotReachHere();
    61    ShouldNotReachHere();
    62   }
    62   }
    63 
    63 
       
    64 #ifdef ASSERT
       
    65   // Check for trying to throw stack overflow before initialization is complete
       
    66   // to prevent infinite recursion trying to initialize stack overflow without
       
    67   // adequate stack space.
       
    68   // This can happen with stress testing a large value of StackShadowPages
       
    69   if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
       
    70     instanceKlass* ik = instanceKlass::cast(h_exception->klass());
       
    71     assert(ik->is_initialized(),
       
    72            "need to increase min_stack_allowed calculation");
       
    73   }
       
    74 #endif // ASSERT
       
    75 
    64   if (thread->is_VM_thread()
    76   if (thread->is_VM_thread()
    65       || thread->is_Compiler_thread() ) {
    77       || thread->is_Compiler_thread() ) {
    66     // We do not care what kind of exception we get for the vm-thread or a thread which
    78     // We do not care what kind of exception we get for the vm-thread or a thread which
    67     // is compiling.  We just install a dummy exception object
    79     // is compiling.  We just install a dummy exception object
    68     thread->set_pending_exception(Universe::vm_exception(), file, line);
    80     thread->set_pending_exception(Universe::vm_exception(), file, line);
    89     // We do not care what kind of exception we get for the vm-thread or a thread which
   101     // We do not care what kind of exception we get for the vm-thread or a thread which
    90     // is compiling.  We just install a dummy exception object
   102     // is compiling.  We just install a dummy exception object
    91     thread->set_pending_exception(Universe::vm_exception(), file, line);
   103     thread->set_pending_exception(Universe::vm_exception(), file, line);
    92     return true;
   104     return true;
    93   }
   105   }
    94 
       
    95   return false;
   106   return false;
    96 }
   107 }
    97 
   108 
    98 // This method should only be called from generated code,
   109 // This method should only be called from generated code,
    99 // therefore the exception oop should be in the oopmap.
   110 // therefore the exception oop should be in the oopmap.
   191   Handle exception;
   202   Handle exception;
   192   if (!THREAD->has_pending_exception()) {
   203   if (!THREAD->has_pending_exception()) {
   193     klassOop k = SystemDictionary::StackOverflowError_klass();
   204     klassOop k = SystemDictionary::StackOverflowError_klass();
   194     oop e = instanceKlass::cast(k)->allocate_instance(CHECK);
   205     oop e = instanceKlass::cast(k)->allocate_instance(CHECK);
   195     exception = Handle(THREAD, e);  // fill_in_stack trace does gc
   206     exception = Handle(THREAD, e);  // fill_in_stack trace does gc
       
   207     assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation");
   196     if (StackTraceInThrowable) {
   208     if (StackTraceInThrowable) {
   197       java_lang_Throwable::fill_in_stack_trace(exception);
   209       java_lang_Throwable::fill_in_stack_trace(exception);
   198     }
   210     }
   199   } else {
   211   } else {
   200     // if prior exception, throw that one instead
   212     // if prior exception, throw that one instead