474 }
475
476 // See if we've got enough room on the stack for locals plus overhead below
477 // JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
478 // without going through the signal handler, i.e., reserved and yellow zones
479 // will not be made usable. The shadow zone must suffice to handle the
480 // overflow.
481 // The expression stack grows down incrementally, so the normal guard
482 // page mechanism will work for that.
483 //
484 // NOTE: Since the additional locals are also always pushed (wasn't
485 // obvious in generate_fixed_frame) so the guard should work for them
486 // too.
487 //
488 // Args:
489 // rdx: number of additional locals this frame needs (what we must check)
490 // rbx: Method*
491 //
492 // Kills:
493 // rax
494 void TemplateInterpreterGenerator::generate_stack_overflow_check(void) {
495
496 // monitor entry size: see picture of stack in frame_x86.hpp
497 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
498
499 // total overhead size: entry_size + (saved rbp through expr stack
500 // bottom). be sure to change this if you add/subtract anything
501 // to/from the overhead area
502 const int overhead_size =
503 -(frame::interpreter_frame_initial_sp_offset * wordSize) + entry_size;
504
505 const int page_size = os::vm_page_size();
506
507 Label after_frame_check;
508
509 // see if the frame is greater than one page in size. If so,
510 // then we need to verify there is enough stack space remaining
511 // for the additional locals.
512 __ cmpl(rdx, (page_size - overhead_size) / Interpreter::stackElementSize);
513 __ jcc(Assembler::belowEqual, after_frame_check);
514
|
474 }
475
476 // See if we've got enough room on the stack for locals plus overhead below
477 // JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
478 // without going through the signal handler, i.e., reserved and yellow zones
479 // will not be made usable. The shadow zone must suffice to handle the
480 // overflow.
481 // The expression stack grows down incrementally, so the normal guard
482 // page mechanism will work for that.
483 //
484 // NOTE: Since the additional locals are also always pushed (wasn't
485 // obvious in generate_fixed_frame) so the guard should work for them
486 // too.
487 //
488 // Args:
489 // rdx: number of additional locals this frame needs (what we must check)
490 // rbx: Method*
491 //
492 // Kills:
493 // rax
494 void TemplateInterpreterGenerator::generate_stack_overflow_check(Register unused1, Register unused2, Register unused3) {
495 assert(unused1 == noreg && unused2 == noreg && unused3 == noreg, "Not used on x86");
496
497 // monitor entry size: see picture of stack in frame_x86.hpp
498 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
499
500 // total overhead size: entry_size + (saved rbp through expr stack
501 // bottom). be sure to change this if you add/subtract anything
502 // to/from the overhead area
503 const int overhead_size =
504 -(frame::interpreter_frame_initial_sp_offset * wordSize) + entry_size;
505
506 const int page_size = os::vm_page_size();
507
508 Label after_frame_check;
509
510 // see if the frame is greater than one page in size. If so,
511 // then we need to verify there is enough stack space remaining
512 // for the additional locals.
513 __ cmpl(rdx, (page_size - overhead_size) / Interpreter::stackElementSize);
514 __ jcc(Assembler::belowEqual, after_frame_check);
515
|