< prev index next >

src/share/vm/opto/parse1.cpp

Print this page

        

@@ -395,10 +395,11 @@
   _wrote_final = false;
   _wrote_volatile = false;
   _wrote_stable = false;
   _wrote_fields = false;
   _alloc_with_final = NULL;
+  _alloc_with_stable = NodeSentinel;
   _entry_bci = InvocationEntryBci;
   _tf = NULL;
   _block = NULL;
   _first_return = true;
   _replaced_nodes_for_exceptions = false;

@@ -955,11 +956,20 @@
   //
   if (method()->is_initializer() &&
         (wrote_final() ||
            PPC64_ONLY(wrote_volatile() ||)
            (AlwaysSafeConstructors && wrote_fields()))) {
-    _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
+    // For PPC64 worte volatile, if using allocation node as Precedent input
+    // in MemBarRelease node and allocation is not escaped, MemBarRelease will
+    // be removed. As written volatile field is not definitly allocation
+    // instance's field (different with final), can't safely remove MemBar
+    // when allocation is not escape.
+    Node *allocate = alloc_with_final();
+    if (PPC64_ONLY(wrote_volatile()) NOT_PPC(false)) {
+        allocate = NULL;
+    }
+    _exits.insert_mem_bar(Op_MemBarRelease, allocate);
 #ifndef PRODUCT
     if (PrintOpto && (Verbose || WizardMode)) {
       method()->print_name();
       tty->print_cr(" writes finals and needs a memory barrier");
     }

@@ -968,11 +978,11 @@
 
   // Any method can write a @Stable field; insert memory barriers after
   // those also. If there is a predecessor allocation node, bind the
   // barrier there.
   if (wrote_stable()) {
-    _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
+    _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_stable());
 #ifndef PRODUCT
     if (PrintOpto && (Verbose || WizardMode)) {
       method()->print_name();
       tty->print_cr(" writes @Stable and needs a memory barrier");
     }
< prev index next >