< prev index next >

src/cpu/zero/vm/stack_zero.cpp

Print this page




  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "interpreter/interpreterRuntime.hpp"
  28 #include "runtime/thread.hpp"
  29 #include "stack_zero.hpp"
  30 #include "stack_zero.inline.hpp"
  31 
  32 // Inlined causes circular inclusion with thread.hpp
  33 ZeroStack::ZeroStack()
  34     : _base(NULL), _top(NULL), _sp(NULL) {
  35     _shadow_pages_size = JavaThread::stack_shadow_zone_size();
  36   }
  37 
  38 int ZeroStack::suggest_size(Thread *thread) const {
  39   assert(needs_setup(), "already set up");
  40   int abi_available = abi_stack_available(thread);
  41   assert(abi_available >= 0, "available abi stack must be >= 0");
  42   return align_size_down(abi_available / 2, wordSize);
  43 }
  44 
  45 void ZeroStack::handle_overflow(TRAPS) {
  46   JavaThread *thread = (JavaThread *) THREAD;
  47 
  48   // Set up the frame anchor if it isn't already
  49   bool has_last_Java_frame = thread->has_last_Java_frame();
  50   if (!has_last_Java_frame) {
  51     intptr_t *sp = thread->zero_stack()->sp();
  52     ZeroFrame *frame = thread->top_zero_frame();
  53     while (frame) {
  54       if (frame->is_shark_frame())
  55         break;
  56 
  57       if (frame->is_interpreter_frame()) {
  58         interpreterState istate =
  59           frame->as_interpreter_frame()->interpreter_state();
  60         if (istate->self_link() == istate)
  61           break;
  62       }




  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "interpreter/interpreterRuntime.hpp"
  28 #include "runtime/thread.hpp"
  29 #include "stack_zero.hpp"
  30 #include "stack_zero.inline.hpp"
  31 
  32 // Inlined causes circular inclusion with thread.hpp
  33 ZeroStack::ZeroStack()
  34     : _base(NULL), _top(NULL), _sp(NULL) {
  35     _shadow_pages_size = JavaThread::stack_shadow_zone_size();
  36   }
  37 
  38 int ZeroStack::suggest_size(Thread *thread) const {
  39   assert(needs_setup(), "already set up");
  40   int abi_available = abi_stack_available(thread);
  41   assert(abi_available >= 0, "available abi stack must be >= 0");
  42   return align_down(abi_available / 2, wordSize);
  43 }
  44 
  45 void ZeroStack::handle_overflow(TRAPS) {
  46   JavaThread *thread = (JavaThread *) THREAD;
  47 
  48   // Set up the frame anchor if it isn't already
  49   bool has_last_Java_frame = thread->has_last_Java_frame();
  50   if (!has_last_Java_frame) {
  51     intptr_t *sp = thread->zero_stack()->sp();
  52     ZeroFrame *frame = thread->top_zero_frame();
  53     while (frame) {
  54       if (frame->is_shark_frame())
  55         break;
  56 
  57       if (frame->is_interpreter_frame()) {
  58         interpreterState istate =
  59           frame->as_interpreter_frame()->interpreter_state();
  60         if (istate->self_link() == istate)
  61           break;
  62       }


< prev index next >