diff 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
line wrap: on
line diff
--- a/src/cpu/sparc/vm/assembler_sparc.hpp	Mon Apr 14 20:56:48 2014 -0400
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Thu Apr 10 23:15:13 2014 -0700
@@ -630,11 +630,20 @@
   }
 
  protected:
+  // Insert a nop if the previous is cbcond
+  void insert_nop_after_cbcond() {
+    if (UseCBCond && cbcond_before()) {
+      nop();
+    }
+  }
   // Delay slot helpers
   // cti is called when emitting control-transfer instruction,
   // BEFORE doing the emitting.
   // Only effective when assertion-checking is enabled.
   void cti() {
+    // A cbcond instruction immediately followed by a CTI
+    // instruction introduces pipeline stalls, we need to avoid that.
+    no_cbcond_before();
 #ifdef CHECK_DELAY
     assert_not_delayed("cti should not be in delay slot");
 #endif
@@ -658,7 +667,6 @@
   void no_cbcond_before() {
     assert(offset() == 0 || !cbcond_before(), "cbcond should not follow an other cbcond");
   }
-
 public:
 
   bool use_cbcond(Label& L) {