src/cpu/x86/vm/sharedRuntime_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/cpu/x86/vm

src/cpu/x86/vm/sharedRuntime_x86_64.cpp

Print this page
rev 6086 : 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
Summary: make compiled code bang the stack by the worst case size of the interpreter frame at deoptimization points.
Reviewed-by:


3460   //
3461   // Frame picture (youngest to oldest)
3462   // 1: self-frame (no frame link)
3463   // 2: deopting frame  (no frame link)
3464   // 3: caller of deopting frame (could be compiled/interpreted).
3465   //
3466   // Note: by leaving the return address of self-frame on the stack
3467   // and using the size of frame 2 to adjust the stack
3468   // when we are done the return to frame 3 will still be on the stack.
3469 
3470   // Pop deoptimized frame
3471   __ movl(rcx, Address(rdi, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes()));
3472   __ addptr(rsp, rcx);
3473 
3474   // rsp should be pointing at the return address to the caller (3)
3475 
3476   // Pick up the initial fp we should save
3477   // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
3478   __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
3479 
3480   // Stack bang to make sure there's enough room for these interpreter frames.



3481   if (UseStackBanging) {
3482     __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
3483     __ bang_stack_size(rbx, rcx);
3484   }

3485 
3486   // Load address of array of frame pcs into rcx
3487   __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
3488 
3489   // Trash the old pc
3490   __ addptr(rsp, wordSize);
3491 
3492   // Load address of array of frame sizes into rsi
3493   __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes()));
3494 
3495   // Load counter into rdx
3496   __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
3497 
3498   // Now adjust the caller's stack to make up for the extra locals
3499   // but record the original sp so that we can save it in the skeletal interpreter
3500   // frame and the stack walking of interpreter_sender will get the unextended sp
3501   // value and not the "real" sp value.
3502 
3503   const Register sender_sp = r8;
3504 


3653   // Frame picture (youngest to oldest)
3654   // 1: self-frame (no frame link)
3655   // 2: deopting frame  (no frame link)
3656   // 3: caller of deopting frame (could be compiled/interpreted).
3657 
3658   // Pop self-frame.  We have no frame, and must rely only on rax and rsp.
3659   __ addptr(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog!
3660 
3661   // Pop deoptimized frame (int)
3662   __ movl(rcx, Address(rdi,
3663                        Deoptimization::UnrollBlock::
3664                        size_of_deoptimized_frame_offset_in_bytes()));
3665   __ addptr(rsp, rcx);
3666 
3667   // rsp should be pointing at the return address to the caller (3)
3668 
3669   // Pick up the initial fp we should save
3670   // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
3671   __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
3672 
3673   // Stack bang to make sure there's enough room for these interpreter frames.



3674   if (UseStackBanging) {
3675     __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
3676     __ bang_stack_size(rbx, rcx);
3677   }

3678 
3679   // Load address of array of frame pcs into rcx (address*)
3680   __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
3681 
3682   // Trash the return pc
3683   __ addptr(rsp, wordSize);
3684 
3685   // Load address of array of frame sizes into rsi (intptr_t*)
3686   __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock:: frame_sizes_offset_in_bytes()));
3687 
3688   // Counter
3689   __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock:: number_of_frames_offset_in_bytes())); // (int)
3690 
3691   // Now adjust the caller's stack to make up for the extra locals but
3692   // record the original sp so that we can save it in the skeletal
3693   // interpreter frame and the stack walking of interpreter_sender
3694   // will get the unextended sp value and not the "real" sp value.
3695 
3696   const Register sender_sp = r8;
3697 




3460   //
3461   // Frame picture (youngest to oldest)
3462   // 1: self-frame (no frame link)
3463   // 2: deopting frame  (no frame link)
3464   // 3: caller of deopting frame (could be compiled/interpreted).
3465   //
3466   // Note: by leaving the return address of self-frame on the stack
3467   // and using the size of frame 2 to adjust the stack
3468   // when we are done the return to frame 3 will still be on the stack.
3469 
3470   // Pop deoptimized frame
3471   __ movl(rcx, Address(rdi, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes()));
3472   __ addptr(rsp, rcx);
3473 
3474   // rsp should be pointing at the return address to the caller (3)
3475 
3476   // Pick up the initial fp we should save
3477   // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
3478   __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
3479 
3480 #ifdef ASSERT
3481   // Compilers generate code that bang the stack by as much as the
3482   // interpreter would need. So this stack banging should never
3483   // trigger a fault. Verify that it does not on non product builds.
3484   if (UseStackBanging) {
3485     __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
3486     __ bang_stack_size(rbx, rcx);
3487   }
3488 #endif
3489 
3490   // Load address of array of frame pcs into rcx
3491   __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
3492 
3493   // Trash the old pc
3494   __ addptr(rsp, wordSize);
3495 
3496   // Load address of array of frame sizes into rsi
3497   __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes()));
3498 
3499   // Load counter into rdx
3500   __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
3501 
3502   // Now adjust the caller's stack to make up for the extra locals
3503   // but record the original sp so that we can save it in the skeletal interpreter
3504   // frame and the stack walking of interpreter_sender will get the unextended sp
3505   // value and not the "real" sp value.
3506 
3507   const Register sender_sp = r8;
3508 


3657   // Frame picture (youngest to oldest)
3658   // 1: self-frame (no frame link)
3659   // 2: deopting frame  (no frame link)
3660   // 3: caller of deopting frame (could be compiled/interpreted).
3661 
3662   // Pop self-frame.  We have no frame, and must rely only on rax and rsp.
3663   __ addptr(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog!
3664 
3665   // Pop deoptimized frame (int)
3666   __ movl(rcx, Address(rdi,
3667                        Deoptimization::UnrollBlock::
3668                        size_of_deoptimized_frame_offset_in_bytes()));
3669   __ addptr(rsp, rcx);
3670 
3671   // rsp should be pointing at the return address to the caller (3)
3672 
3673   // Pick up the initial fp we should save
3674   // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
3675   __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
3676 
3677 #ifdef ASSERT
3678   // Compilers generate code that bang the stack by as much as the
3679   // interpreter would need. So this stack banging should never
3680   // trigger a fault. Verify that it does not on non product builds.
3681   if (UseStackBanging) {
3682     __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
3683     __ bang_stack_size(rbx, rcx);
3684   }
3685 #endif
3686 
3687   // Load address of array of frame pcs into rcx (address*)
3688   __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
3689 
3690   // Trash the return pc
3691   __ addptr(rsp, wordSize);
3692 
3693   // Load address of array of frame sizes into rsi (intptr_t*)
3694   __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock:: frame_sizes_offset_in_bytes()));
3695 
3696   // Counter
3697   __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock:: number_of_frames_offset_in_bytes())); // (int)
3698 
3699   // Now adjust the caller's stack to make up for the extra locals but
3700   // record the original sp so that we can save it in the skeletal
3701   // interpreter frame and the stack walking of interpreter_sender
3702   // will get the unextended sp value and not the "real" sp value.
3703 
3704   const Register sender_sp = r8;
3705 


src/cpu/x86/vm/sharedRuntime_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File