Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/sharedRuntime_x86_64.cpp @ 13384:fca8f4799229
8028308: nsk regression, assert(obj->is_oop()) failed: not an oop
Summary: rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs
Reviewed-by: kvn, iveresov
author | roland |
---|---|
date | Wed, 20 Nov 2013 12:46:08 +0100 |
parents | e7f5651d459c |
children | 02f27ecb4f3a de6a9e811145 1174c8abbdb6 |
comparison
equal
deleted
inserted
replaced
13383:938e1e64e28f | 13384:fca8f4799229 |
---|---|
3469 __ movl(rcx, Address(rdi, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes())); | 3469 __ movl(rcx, Address(rdi, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes())); |
3470 __ addptr(rsp, rcx); | 3470 __ addptr(rsp, rcx); |
3471 | 3471 |
3472 // rsp should be pointing at the return address to the caller (3) | 3472 // rsp should be pointing at the return address to the caller (3) |
3473 | 3473 |
3474 // Pick up the initial fp we should save | |
3475 // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved) | |
3476 __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes())); | |
3477 | |
3474 // Stack bang to make sure there's enough room for these interpreter frames. | 3478 // Stack bang to make sure there's enough room for these interpreter frames. |
3475 if (UseStackBanging) { | 3479 if (UseStackBanging) { |
3476 __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes())); | 3480 __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes())); |
3477 __ bang_stack_size(rbx, rcx); | 3481 __ bang_stack_size(rbx, rcx); |
3478 } | 3482 } |
3486 // Load address of array of frame sizes into rsi | 3490 // Load address of array of frame sizes into rsi |
3487 __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes())); | 3491 __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes())); |
3488 | 3492 |
3489 // Load counter into rdx | 3493 // Load counter into rdx |
3490 __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes())); | 3494 __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes())); |
3491 | |
3492 // Pick up the initial fp we should save | |
3493 __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes())); | |
3494 | 3495 |
3495 // Now adjust the caller's stack to make up for the extra locals | 3496 // Now adjust the caller's stack to make up for the extra locals |
3496 // but record the original sp so that we can save it in the skeletal interpreter | 3497 // but record the original sp so that we can save it in the skeletal interpreter |
3497 // frame and the stack walking of interpreter_sender will get the unextended sp | 3498 // frame and the stack walking of interpreter_sender will get the unextended sp |
3498 // value and not the "real" sp value. | 3499 // value and not the "real" sp value. |
3661 size_of_deoptimized_frame_offset_in_bytes())); | 3662 size_of_deoptimized_frame_offset_in_bytes())); |
3662 __ addptr(rsp, rcx); | 3663 __ addptr(rsp, rcx); |
3663 | 3664 |
3664 // rsp should be pointing at the return address to the caller (3) | 3665 // rsp should be pointing at the return address to the caller (3) |
3665 | 3666 |
3667 // Pick up the initial fp we should save | |
3668 // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved) | |
3669 __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes())); | |
3670 | |
3666 // Stack bang to make sure there's enough room for these interpreter frames. | 3671 // Stack bang to make sure there's enough room for these interpreter frames. |
3667 if (UseStackBanging) { | 3672 if (UseStackBanging) { |
3668 __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes())); | 3673 __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes())); |
3669 __ bang_stack_size(rbx, rcx); | 3674 __ bang_stack_size(rbx, rcx); |
3670 } | 3675 } |
3671 | 3676 |
3672 // Load address of array of frame pcs into rcx (address*) | 3677 // Load address of array of frame pcs into rcx (address*) |
3673 __ movptr(rcx, | 3678 __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); |
3674 Address(rdi, | |
3675 Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); | |
3676 | 3679 |
3677 // Trash the return pc | 3680 // Trash the return pc |
3678 __ addptr(rsp, wordSize); | 3681 __ addptr(rsp, wordSize); |
3679 | 3682 |
3680 // Load address of array of frame sizes into rsi (intptr_t*) | 3683 // Load address of array of frame sizes into rsi (intptr_t*) |
3681 __ movptr(rsi, Address(rdi, | 3684 __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock:: frame_sizes_offset_in_bytes())); |
3682 Deoptimization::UnrollBlock:: | |
3683 frame_sizes_offset_in_bytes())); | |
3684 | 3685 |
3685 // Counter | 3686 // Counter |
3686 __ movl(rdx, Address(rdi, | 3687 __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock:: number_of_frames_offset_in_bytes())); // (int) |
3687 Deoptimization::UnrollBlock:: | |
3688 number_of_frames_offset_in_bytes())); // (int) | |
3689 | |
3690 // Pick up the initial fp we should save | |
3691 __ movptr(rbp, | |
3692 Address(rdi, | |
3693 Deoptimization::UnrollBlock::initial_info_offset_in_bytes())); | |
3694 | 3688 |
3695 // Now adjust the caller's stack to make up for the extra locals but | 3689 // Now adjust the caller's stack to make up for the extra locals but |
3696 // record the original sp so that we can save it in the skeletal | 3690 // record the original sp so that we can save it in the skeletal |
3697 // interpreter frame and the stack walking of interpreter_sender | 3691 // interpreter frame and the stack walking of interpreter_sender |
3698 // will get the unextended sp value and not the "real" sp value. | 3692 // will get the unextended sp value and not the "real" sp value. |
3699 | 3693 |
3700 const Register sender_sp = r8; | 3694 const Register sender_sp = r8; |
3701 | 3695 |
3702 __ mov(sender_sp, rsp); | 3696 __ mov(sender_sp, rsp); |
3703 __ movl(rbx, Address(rdi, | 3697 __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock:: caller_adjustment_offset_in_bytes())); // (int) |
3704 Deoptimization::UnrollBlock:: | |
3705 caller_adjustment_offset_in_bytes())); // (int) | |
3706 __ subptr(rsp, rbx); | 3698 __ subptr(rsp, rbx); |
3707 | 3699 |
3708 // Push interpreter frames in a loop | 3700 // Push interpreter frames in a loop |
3709 Label loop; | 3701 Label loop; |
3710 __ bind(loop); | 3702 __ bind(loop); |