hotspot/src/cpu/zero/vm/stack_zero.cpp

Print this page




  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  21  * CA 95054 USA or visit www.sun.com if you need additional information or
  22  * have any questions.
  23  *
  24  */
  25 
  26 #include "incls/_precompiled.incl"
  27 #include "incls/_stack_zero.cpp.incl"
  28 
  29 void ZeroStack::handle_overflow(TRAPS) {
  30   JavaThread *thread = (JavaThread *) THREAD;
  31 
  32   // Set up the frame anchor if it isn't already
  33   bool has_last_Java_frame = thread->has_last_Java_frame();
  34   if (!has_last_Java_frame) {

  35     ZeroFrame *frame = thread->top_zero_frame();
  36     while (frame) {
  37       if (frame->is_shark_frame())
  38         break;
  39 
  40       if (frame->is_interpreter_frame()) {
  41         interpreterState istate =
  42           frame->as_interpreter_frame()->interpreter_state();
  43         if (istate->self_link() == istate)
  44           break;
  45       }
  46 

  47       frame = frame->next();
  48     }
  49 
  50     if (frame == NULL)
  51       fatal("unrecoverable stack overflow");
  52 
  53     thread->set_last_Java_frame(frame);
  54   }
  55 
  56   // Throw the exception
  57   switch (thread->thread_state()) {
  58   case _thread_in_Java:
  59     InterpreterRuntime::throw_StackOverflowError(thread);
  60     break;
  61 
  62   case _thread_in_vm:
  63     Exceptions::throw_stack_overflow_exception(thread, __FILE__, __LINE__);
  64     break;
  65 
  66   default:
  67     ShouldNotReachHere();
  68   }
  69 
  70   // Reset the frame anchor if necessary
  71   if (!has_last_Java_frame)
  72     thread->reset_last_Java_frame();
  73 }


  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  21  * CA 95054 USA or visit www.sun.com if you need additional information or
  22  * have any questions.
  23  *
  24  */
  25 
  26 #include "incls/_precompiled.incl"
  27 #include "incls/_stack_zero.cpp.incl"
  28 
  29 void ZeroStack::handle_overflow(TRAPS) {
  30   JavaThread *thread = (JavaThread *) THREAD;
  31 
  32   // Set up the frame anchor if it isn't already
  33   bool has_last_Java_frame = thread->has_last_Java_frame();
  34   if (!has_last_Java_frame) {
  35     intptr_t *sp = thread->zero_stack()->sp();
  36     ZeroFrame *frame = thread->top_zero_frame();
  37     while (frame) {
  38       if (frame->is_shark_frame())
  39         break;
  40 
  41       if (frame->is_interpreter_frame()) {
  42         interpreterState istate =
  43           frame->as_interpreter_frame()->interpreter_state();
  44         if (istate->self_link() == istate)
  45           break;
  46       }
  47 
  48       sp = ((intptr_t *) frame) + 1;
  49       frame = frame->next();
  50     }
  51 
  52     if (frame == NULL)
  53       fatal("unrecoverable stack overflow");
  54 
  55     thread->set_last_Java_frame(frame, sp);
  56   }
  57 
  58   // Throw the exception
  59   switch (thread->thread_state()) {
  60   case _thread_in_Java:
  61     InterpreterRuntime::throw_StackOverflowError(thread);
  62     break;
  63 
  64   case _thread_in_vm:
  65     Exceptions::throw_stack_overflow_exception(thread, __FILE__, __LINE__);
  66     break;
  67 
  68   default:
  69     ShouldNotReachHere();
  70   }
  71 
  72   // Reset the frame anchor if necessary
  73   if (!has_last_Java_frame)
  74     thread->reset_last_Java_frame();
  75 }