460 461 #ifdef ASSERT 462 Label stack_base_okay, stack_size_okay; 463 // verify that thread stack base is non-zero 464 __ cmpptr(stack_base, (int32_t)NULL_WORD); 465 __ jcc(Assembler::notEqual, stack_base_okay); 466 __ stop("stack base is zero"); 467 __ bind(stack_base_okay); 468 // verify that thread stack size is non-zero 469 __ cmpptr(stack_size, 0); 470 __ jcc(Assembler::notEqual, stack_size_okay); 471 __ stop("stack size is zero"); 472 __ bind(stack_size_okay); 473 #endif 474 475 // Add stack base to locals and subtract stack size 476 __ addptr(rax, stack_base); 477 __ subptr(rax, stack_size); 478 479 // Use the maximum number of pages we might bang. 480 const int max_pages = StackShadowPages > (StackRedPages+StackYellowPages) ? StackShadowPages : 481 (StackRedPages+StackYellowPages); 482 483 // add in the red and yellow zone sizes 484 __ addptr(rax, max_pages * page_size); 485 486 // check against the current stack bottom 487 __ cmpptr(rsp, rax); 488 __ jcc(Assembler::above, after_frame_check); 489 490 // Restore sender's sp as SP. This is necessary if the sender's 491 // frame is an extended compiled frame (see gen_c2i_adapter()) 492 // and safer anyway in case of JSR292 adaptations. 493 494 __ pop(rax); // return address must be moved if SP is changed 495 __ mov(rsp, r13); 496 __ push(rax); 497 498 // Note: the restored frame is not necessarily interpreted. 499 // Use the shared runtime version of the StackOverflowError. 500 assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "stub not yet generated"); 501 __ jump(ExternalAddress(StubRoutines::throw_StackOverflowError_entry())); | 460 461 #ifdef ASSERT 462 Label stack_base_okay, stack_size_okay; 463 // verify that thread stack base is non-zero 464 __ cmpptr(stack_base, (int32_t)NULL_WORD); 465 __ jcc(Assembler::notEqual, stack_base_okay); 466 __ stop("stack base is zero"); 467 __ bind(stack_base_okay); 468 // verify that thread stack size is non-zero 469 __ cmpptr(stack_size, 0); 470 __ jcc(Assembler::notEqual, stack_size_okay); 471 __ stop("stack size is zero"); 472 __ bind(stack_size_okay); 473 #endif 474 475 // Add stack base to locals and subtract stack size 476 __ addptr(rax, stack_base); 477 __ subptr(rax, stack_size); 478 479 // Use the maximum number of pages we might bang. 480 const int max_pages = StackShadowPages > (StackRedPages+StackYellowPages+StackReservedPages) ? StackShadowPages : 481 (StackRedPages+StackYellowPages+StackReservedPages); 482 483 // add in the red and yellow zone sizes 484 __ addptr(rax, max_pages * page_size); 485 486 // check against the current stack bottom 487 __ cmpptr(rsp, rax); 488 __ jcc(Assembler::above, after_frame_check); 489 490 // Restore sender's sp as SP. This is necessary if the sender's 491 // frame is an extended compiled frame (see gen_c2i_adapter()) 492 // and safer anyway in case of JSR292 adaptations. 493 494 __ pop(rax); // return address must be moved if SP is changed 495 __ mov(rsp, r13); 496 __ push(rax); 497 498 // Note: the restored frame is not necessarily interpreted. 499 // Use the shared runtime version of the StackOverflowError. 500 assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "stub not yet generated"); 501 __ jump(ExternalAddress(StubRoutines::throw_StackOverflowError_entry())); |