comparison src/cpu/sparc/vm/assembler_sparc.hpp @ 17877:17b2fbdb6637

8038297: Avoid placing CTI immediately following cbcond instruction on T4 Summary: Insert a nop between cbcond and CTI Reviewed-by: kvn, twisti
author iveresov
date Thu, 10 Apr 2014 23:15:13 -0700
parents 04d32e7fad07
children 03214612e77e
comparison
equal deleted inserted replaced
17875:cb1b723cbca8 17877:17b2fbdb6637
628 assert(delay_state == no_delay, msg); 628 assert(delay_state == no_delay, msg);
629 #endif 629 #endif
630 } 630 }
631 631
632 protected: 632 protected:
633 // Insert a nop if the previous is cbcond
634 void insert_nop_after_cbcond() {
635 if (UseCBCond && cbcond_before()) {
636 nop();
637 }
638 }
633 // Delay slot helpers 639 // Delay slot helpers
634 // cti is called when emitting control-transfer instruction, 640 // cti is called when emitting control-transfer instruction,
635 // BEFORE doing the emitting. 641 // BEFORE doing the emitting.
636 // Only effective when assertion-checking is enabled. 642 // Only effective when assertion-checking is enabled.
637 void cti() { 643 void cti() {
644 // A cbcond instruction immediately followed by a CTI
645 // instruction introduces pipeline stalls, we need to avoid that.
646 no_cbcond_before();
638 #ifdef CHECK_DELAY 647 #ifdef CHECK_DELAY
639 assert_not_delayed("cti should not be in delay slot"); 648 assert_not_delayed("cti should not be in delay slot");
640 #endif 649 #endif
641 } 650 }
642 651
656 } 665 }
657 666
658 void no_cbcond_before() { 667 void no_cbcond_before() {
659 assert(offset() == 0 || !cbcond_before(), "cbcond should not follow an other cbcond"); 668 assert(offset() == 0 || !cbcond_before(), "cbcond should not follow an other cbcond");
660 } 669 }
661
662 public: 670 public:
663 671
664 bool use_cbcond(Label& L) { 672 bool use_cbcond(Label& L) {
665 if (!UseCBCond || cbcond_before()) return false; 673 if (!UseCBCond || cbcond_before()) return false;
666 intptr_t x = intptr_t(target_distance(L)) - intptr_t(pc()); 674 intptr_t x = intptr_t(target_distance(L)) - intptr_t(pc());