hotspot/src/share/vm/opto/parse1.cpp
changeset 35157 1a5fa0acb08b
parent 35071 a0910b1d3e0d
child 36336 7006dd73b206
--- a/hotspot/src/share/vm/opto/parse1.cpp	Mon Dec 21 16:58:29 2015 +0000
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Sun Dec 27 05:15:14 2015 -0800
@@ -962,6 +962,14 @@
            PPC64_ONLY(wrote_volatile() ||)
            (AlwaysSafeConstructors && wrote_fields()))) {
     _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
+
+    // If Memory barrier is created for final fields write
+    // and allocation node does not escape the initialize method,
+    // then barrier introduced by allocation node can be removed.
+    if (DoEscapeAnalysis && alloc_with_final()) {
+      AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
+      alloc->compute_MemBar_redundancy(method());
+    }
     if (PrintOpto && (Verbose || WizardMode)) {
       method()->print_name();
       tty->print_cr(" writes finals and needs a memory barrier");