comparison src/cpu/x86/vm/x86_64.ad @ 17980:0bf37f737702

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: twisti, kvn
author roland
date Tue, 01 Apr 2014 09:36:49 +0200
parents 62c54fcc0a35
children 52b4284cb496
comparison
equal deleted inserted replaced
17978:ad51f24671c2 17980:0bf37f737702
711 //============================================================================= 711 //=============================================================================
712 #ifndef PRODUCT 712 #ifndef PRODUCT
713 void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const { 713 void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
714 Compile* C = ra_->C; 714 Compile* C = ra_->C;
715 715
716 int framesize = C->frame_slots() << LogBytesPerInt; 716 int framesize = C->frame_size_in_bytes();
717 int bangsize = C->bang_size_in_bytes();
717 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 718 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
718 // Remove wordSize for return addr which is already pushed. 719 // Remove wordSize for return addr which is already pushed.
719 framesize -= wordSize; 720 framesize -= wordSize;
720 721
721 if (C->need_stack_bang(framesize)) { 722 if (C->need_stack_bang(bangsize)) {
722 framesize -= wordSize; 723 framesize -= wordSize;
723 st->print("# stack bang"); 724 st->print("# stack bang (%d bytes)", bangsize);
724 st->print("\n\t"); 725 st->print("\n\t");
725 st->print("pushq rbp\t# Save rbp"); 726 st->print("pushq rbp\t# Save rbp");
726 if (framesize) { 727 if (framesize) {
727 st->print("\n\t"); 728 st->print("\n\t");
728 st->print("subq rsp, #%d\t# Create frame",framesize); 729 st->print("subq rsp, #%d\t# Create frame",framesize);
749 750
750 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { 751 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
751 Compile* C = ra_->C; 752 Compile* C = ra_->C;
752 MacroAssembler _masm(&cbuf); 753 MacroAssembler _masm(&cbuf);
753 754
754 int framesize = C->frame_slots() << LogBytesPerInt; 755 int framesize = C->frame_size_in_bytes();
755 756 int bangsize = C->bang_size_in_bytes();
756 __ verified_entry(framesize, C->need_stack_bang(framesize), false); 757
758 __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false);
757 759
758 C->set_frame_complete(cbuf.insts_size()); 760 C->set_frame_complete(cbuf.insts_size());
759 761
760 if (C->has_mach_constant_base_node()) { 762 if (C->has_mach_constant_base_node()) {
761 // NOTE: We set the table base offset here because users might be 763 // NOTE: We set the table base offset here because users might be
784 if (C->max_vector_size() > 16) { 786 if (C->max_vector_size() > 16) {
785 st->print("vzeroupper"); 787 st->print("vzeroupper");
786 st->cr(); st->print("\t"); 788 st->cr(); st->print("\t");
787 } 789 }
788 790
789 int framesize = C->frame_slots() << LogBytesPerInt; 791 int framesize = C->frame_size_in_bytes();
790 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 792 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
791 // Remove word for return adr already pushed 793 // Remove word for return adr already pushed
792 // and RBP 794 // and RBP
793 framesize -= 2*wordSize; 795 framesize -= 2*wordSize;
794 796
820 // wide vectors to avoid AVX <-> SSE transition penalty during call. 822 // wide vectors to avoid AVX <-> SSE transition penalty during call.
821 MacroAssembler _masm(&cbuf); 823 MacroAssembler _masm(&cbuf);
822 __ vzeroupper(); 824 __ vzeroupper();
823 } 825 }
824 826
825 int framesize = C->frame_slots() << LogBytesPerInt; 827 int framesize = C->frame_size_in_bytes();
826 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 828 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
827 // Remove word for return adr already pushed 829 // Remove word for return adr already pushed
828 // and RBP 830 // and RBP
829 framesize -= 2*wordSize; 831 framesize -= 2*wordSize;
830 832