< prev index next >

src/share/vm/opto/parse1.cpp

Print this page

        

@@ -965,14 +965,23 @@
     }
 #endif
   }
 
   // Any method can write a @Stable field; insert memory barriers after
-  // those also. If there is a predecessor allocation node, bind the
-  // barrier there.
+  // those also. Can't bind predecessor allocation node with barrier.
+  // Because allocation doesn't always dominate MemBarRelease. Example
+  // foo(StableFieldObject s) {
+  //   if (s != null) return s;
+  //   s = new StableFieldObject();
+  //   s.stable = 1;
+  // }
+  // MemBarRelease inserted at exit is not dominated by allocation 
+  // (early return path might take) and will trigger assertion when
+  // verify_dominance, because use (MemBarRelease) is not dominate by
+  // def (allocation).
   if (wrote_stable()) {
-    _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
+    _exits.insert_mem_bar(Op_MemBarRelease);
 #ifndef PRODUCT
     if (PrintOpto && (Verbose || WizardMode)) {
       method()->print_name();
       tty->print_cr(" writes @Stable and needs a memory barrier");
     }
< prev index next >