diff src/share/vm/opto/stringopts.cpp @ 24094:9b69cec6d01b

Merge with jdk8u121-b13
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Mon, 06 Feb 2017 17:18:57 +0100
parents f13e777eb255 173a1f83c930
children
line wrap: on
line diff
--- a/src/share/vm/opto/stringopts.cpp	Sat Feb 04 15:24:10 2017 +0100
+++ b/src/share/vm/opto/stringopts.cpp	Mon Feb 06 17:18:57 2017 +0100
@@ -1641,16 +1641,11 @@
     }
     kit.store_String_value(kit.control(), result, char_array);
 
-    // Do not let stores that initialize this object be reordered with
-    // a subsequent store that would make this object accessible by
-    // other threads.
-    // Record what AllocateNode this StoreStore protects so that
-    // escape analysis can go from the MemBarStoreStoreNode to the
-    // AllocateNode and eliminate the MemBarStoreStoreNode if possible
-    // based on the escape status of the AllocateNode.
-    AllocateNode* alloc = AllocateNode::Ideal_allocation(result, _gvn);
-    assert(alloc != NULL, "should be newly allocated");
-    kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
+    // The value field is final. Emit a barrier here to ensure that the effect
+    // of the initialization is committed to memory before any code publishes
+    // a reference to the newly constructed object (see Parse::do_exits()).
+    assert(AllocateNode::Ideal_allocation(result, _gvn) != NULL, "should be newly allocated");
+    kit.insert_mem_bar(Op_MemBarRelease, result);
   } else {
     result = C->top();
   }