comparison src/cpu/x86/vm/x86_32.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
510 //============================================================================= 510 //=============================================================================
511 #ifndef PRODUCT 511 #ifndef PRODUCT
512 void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const { 512 void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
513 Compile* C = ra_->C; 513 Compile* C = ra_->C;
514 514
515 int framesize = C->frame_slots() << LogBytesPerInt; 515 int framesize = C->frame_size_in_bytes();
516 int bangsize = C->bang_size_in_bytes();
516 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 517 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
517 // Remove wordSize for return addr which is already pushed. 518 // Remove wordSize for return addr which is already pushed.
518 framesize -= wordSize; 519 framesize -= wordSize;
519 520
520 if (C->need_stack_bang(framesize)) { 521 if (C->need_stack_bang(bangsize)) {
521 framesize -= wordSize; 522 framesize -= wordSize;
522 st->print("# stack bang"); 523 st->print("# stack bang (%d bytes)", bangsize);
523 st->print("\n\t"); 524 st->print("\n\t");
524 st->print("PUSH EBP\t# Save EBP"); 525 st->print("PUSH EBP\t# Save EBP");
525 if (framesize) { 526 if (framesize) {
526 st->print("\n\t"); 527 st->print("\n\t");
527 st->print("SUB ESP, #%d\t# Create frame",framesize); 528 st->print("SUB ESP, #%d\t# Create frame",framesize);
561 562
562 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { 563 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
563 Compile* C = ra_->C; 564 Compile* C = ra_->C;
564 MacroAssembler _masm(&cbuf); 565 MacroAssembler _masm(&cbuf);
565 566
566 int framesize = C->frame_slots() << LogBytesPerInt; 567 int framesize = C->frame_size_in_bytes();
567 568 int bangsize = C->bang_size_in_bytes();
568 __ verified_entry(framesize, C->need_stack_bang(framesize), C->in_24_bit_fp_mode()); 569
570 __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode());
569 571
570 C->set_frame_complete(cbuf.insts_size()); 572 C->set_frame_complete(cbuf.insts_size());
571 573
572 if (C->has_mach_constant_base_node()) { 574 if (C->has_mach_constant_base_node()) {
573 // NOTE: We set the table base offset here because users might be 575 // NOTE: We set the table base offset here because users might be
587 589
588 //============================================================================= 590 //=============================================================================
589 #ifndef PRODUCT 591 #ifndef PRODUCT
590 void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream* st ) const { 592 void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream* st ) const {
591 Compile *C = ra_->C; 593 Compile *C = ra_->C;
592 int framesize = C->frame_slots() << LogBytesPerInt; 594 int framesize = C->frame_size_in_bytes();
593 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 595 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
594 // Remove two words for return addr and rbp, 596 // Remove two words for return addr and rbp,
595 framesize -= 2*wordSize; 597 framesize -= 2*wordSize;
596 598
597 if (C->max_vector_size() > 16) { 599 if (C->max_vector_size() > 16) {
627 if (C->in_24_bit_fp_mode()) { 629 if (C->in_24_bit_fp_mode()) {
628 MacroAssembler masm(&cbuf); 630 MacroAssembler masm(&cbuf);
629 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std())); 631 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
630 } 632 }
631 633
632 int framesize = C->frame_slots() << LogBytesPerInt; 634 int framesize = C->frame_size_in_bytes();
633 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 635 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
634 // Remove two words for return addr and rbp, 636 // Remove two words for return addr and rbp,
635 framesize -= 2*wordSize; 637 framesize -= 2*wordSize;
636 638
637 // Note that VerifyStackAtCalls' Majik cookie does not change the frame size popped here 639 // Note that VerifyStackAtCalls' Majik cookie does not change the frame size popped here
661 // If method set FPU control word, restore to standard control word 663 // If method set FPU control word, restore to standard control word
662 int size = C->in_24_bit_fp_mode() ? 6 : 0; 664 int size = C->in_24_bit_fp_mode() ? 6 : 0;
663 if (C->max_vector_size() > 16) size += 3; // vzeroupper 665 if (C->max_vector_size() > 16) size += 3; // vzeroupper
664 if (do_polling() && C->is_method_compilation()) size += 6; 666 if (do_polling() && C->is_method_compilation()) size += 6;
665 667
666 int framesize = C->frame_slots() << LogBytesPerInt; 668 int framesize = C->frame_size_in_bytes();
667 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 669 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
668 // Remove two words for return addr and rbp, 670 // Remove two words for return addr and rbp,
669 framesize -= 2*wordSize; 671 framesize -= 2*wordSize;
670 672
671 size++; // popl rbp, 673 size++; // popl rbp,